net: lwm2m: json: fix potential buffer overflow
Use the size of the target buffer as the maximum length when formatting with snprintf. See https://habr.com/en/company/pvs-studio/blog/495284/ fragment 3. Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
parent
fbc72889af
commit
687826e83e
1 changed files with 1 additions and 1 deletions
|
@ -823,7 +823,7 @@ int do_write_op_json(struct lwm2m_message *msg)
|
|||
}
|
||||
|
||||
/* combine base_name + name */
|
||||
snprintf(full_name, TOKEN_BUF_LEN, "%s%s",
|
||||
snprintf(full_name, sizeof(full_name), "%s%s",
|
||||
base_name, value);
|
||||
|
||||
/* parse full_name into path */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue