Diff between 870fe03a79fa990c40f37f037e9236dba11811e2 and 1796f00e846561af80679efba4d7c36c78710fb6

Changed Files

File Additions Deletions Status
lib/sdp.c +8 -0 modified

Full Patch

diff --git a/lib/sdp.c b/lib/sdp.c
index 7ab7379..e1943dd 100644
--- a/lib/sdp.c
+++ b/lib/sdp.c
@@ -4169,6 +4169,14 @@ int sdp_process(sdp_session_t *session)
 		rsp_count = bt_get_be16(pdata);
 		SDPDBG("Attrlist byte count : %d\n", rsp_count);
 
+		/* Valid range for rsp_count is 0x0002-0xFFFF */
+		if (rsp_count < 0x0002) {
+			t->err = EPROTO;
+			SDPERR("Protocol error: invalid AttrList size");
+			status = SDP_INVALID_PDU_SIZE;
+			goto end;
+		}
+
 		/*
 		 * Number of bytes in the AttributeLists parameter(without
 		 * continuation state) + AttributeListsByteCount field size.