Skip to content

Commit

Permalink
net: lwm2m: lwm2m_message_handling: fix validation of time.
Browse files Browse the repository at this point in the history
Currently the if statement checks if the write_buf_len is the
sizeof(time_t), when CONFIG_LWM2M_ENGINE_VALIDATION_BUFFER_SIZE
is > 0 it will always assume the the resource buf len is
not supported unless CONFIG_LWM2M_ENGINE_VALIDATION_BUFFER_SIZE
is equal to sizeof(time_t). To fix this the check should be
CONFIG_LWM2M_ENGINE_VALIDATION_BUFFER_SIZE >= sizeof(time_t).

Signed-off-by: Brandon Allen <brandon.allen@exacttechnology.com>
  • Loading branch information
brandon-exact committed Feb 7, 2025
1 parent be91cfe commit ee70de7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion subsys/net/lib/lwm2m/lwm2m_message_handling.c
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@ int lwm2m_write_handler(struct lwm2m_engine_obj_inst *obj_inst, struct lwm2m_eng
break;
}

if (write_buf_len == sizeof(time_t)) {
if (write_buf_len >= sizeof(time_t)) {
*(time_t *)write_buf = temp_time;
len = sizeof(time_t);
} else if (write_buf_len == sizeof(uint32_t)) {
Expand Down

0 comments on commit ee70de7

Please sign in to comment.