Commit 12559bf5 authored by Robert Lubos's avatar Robert Lubos Committed by Anas Nashif
Browse files

net: lwm2m: Prevent infinite loop in do_write_op_tlv function

In case unsopported TLV type or malformed packet is received, the
`do_write_op_tlv` function will end up in an infinite loop. Prevent that
by returning an error code in case it does not recognize TLV type.

Signed-off-by: default avatarRobert Lubos <robert.lubos@nordicsemi.no>
parent c1af0c22
Loading
Loading
Loading
Loading
+2 −0
Changes for subsys/net/lib/lwm2m/lwm2m_rw_oma_tlv.c: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -949,6 +949,8 @@ int do_write_op_tlv(struct lwm2m_engine_obj *obj, struct lwm2m_message *msg)
			       msg->operation == LWM2M_OP_CREATE))) {
				return ret;
			}
		} else {
			return -ENOTSUP;
		}
	}