Commit 57189b41 authored by Robert Lubos's avatar Robert Lubos Committed by Benjamin Cabé
Browse files

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: default avatarRobert Lubos <robert.lubos@nordicsemi.no>
parent 3fd7f89f
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -159,6 +159,10 @@ int lwm2m_gw_handle_req(struct lwm2m_message *msg)
		return ret;
	}

	if (ret == 0) {
		return -ENOENT;
	}

	for (int index = 0; index < MAX_INSTANCE_COUNT; index++) {
		/* Skip uninitialized objects */
		if (!inst[index].obj) {