Skip to content

Commit 57189b4

Browse files
rluboskartben
authored andcommitted
net: lwm2m: gateway: Prevent underflow when processing URI options
lwm2m_gw_handle_req() function logic expects that at least one URI option was found, therefore add an extra check to return the function early if that isn't the case. Signed-off-by: Robert Lubos <[email protected]>
1 parent 3fd7f89 commit 57189b4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

subsys/net/lib/lwm2m/lwm2m_obj_gateway.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@ int lwm2m_gw_handle_req(struct lwm2m_message *msg)
159159
return ret;
160160
}
161161

162+
if (ret == 0) {
163+
return -ENOENT;
164+
}
165+
162166
for (int index = 0; index < MAX_INSTANCE_COUNT; index++) {
163167
/* Skip uninitialized objects */
164168
if (!inst[index].obj) {

0 commit comments

Comments
 (0)