Skip to content

Commit 061de03

Browse files
huelsenfruchtzwergjukkar
authored andcommitted
net: lwm2m: fix buffer length check in lwm2m_engine_set
Previously, lwm2m_engine set would check against the max_data_len parameter of the ressource, but didn't take into consideration the (possibly changed) max_data_len returned by the pre_write callback. Fixes #30541 Signed-off-by: Henning Fleddermann <[email protected]>
1 parent c45e7f3 commit 061de03

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

subsys/net/lib/lwm2m/lwm2m_engine.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1487,7 +1487,7 @@ static int lwm2m_engine_set(char *pathstr, void *value, uint16_t len)
14871487
}
14881488

14891489
/* check length (note: we add 1 to string length for NULL pad) */
1490-
if (len > res_inst->max_data_len -
1490+
if (len > max_data_len -
14911491
(obj_field->data_type == LWM2M_RES_TYPE_STRING ? 1 : 0)) {
14921492
LOG_ERR("length %u is too long for res instance %d data",
14931493
len, path.res_id);

0 commit comments

Comments
 (0)