From ba9888c3cf663be883e5c7b78f1cf74e418a719c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Dalleau?= Date: Mon, 20 Feb 2012 21:57:57 +0100 Subject: [PATCH] sdp: Check type of sdp data before dereferencing --- lib/sdp.c | 2 +- lib/sdp.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/sdp.c b/lib/sdp.c index a48ee14f3..57f630a58 100644 --- a/lib/sdp.c +++ b/lib/sdp.c @@ -2065,7 +2065,7 @@ int sdp_get_profile_descs(const sdp_record_t *rec, sdp_list_t **profDescSeq) if (SDP_IS_UUID(seq->dtd)) { uuid = &seq->val.uuid; - } else { + } else if (SDP_IS_SEQ(seq->dtd)) { sdp_data_t *puuid = seq->val.dataseq; sdp_data_t *pVnum = seq->val.dataseq->next; if (puuid && pVnum) { diff --git a/lib/sdp.h b/lib/sdp.h index 5f7d271b7..2fe74d54d 100644 --- a/lib/sdp.h +++ b/lib/sdp.h @@ -432,6 +432,7 @@ typedef struct { } uuid_t; #define SDP_IS_UUID(x) ((x) == SDP_UUID16 || (x) == SDP_UUID32 || (x) ==SDP_UUID128) +#define SDP_IS_SEQ(x) ((x) == SDP_SEQ8 || (x) == SDP_SEQ16 || (x) == SDP_SEQ32) typedef struct _sdp_list sdp_list_t; struct _sdp_list { -- 2.47.3