From 02cd65fff0eac590c55968509c9023b691c69245 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 26 Feb 2009 09:21:23 +0200 Subject: Require all parsed elements in extract_des to be of the same type The extract_des function returns just one element type to the caller so if there are mixed elements it'll be impossible for the caller to know how to handle the returned list. --- src/sdpd-request.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/sdpd-request.c b/src/sdpd-request.c index 5bdb4016..44d30181 100644 --- a/src/sdpd-request.c +++ b/src/sdpd-request.c @@ -101,7 +101,7 @@ static int extract_des(uint8_t *buf, int len, sdp_list_t **svcReqSeq, uint8_t *p short numberOfElements = 0; int seqlen = 0; sdp_list_t *pSeq = NULL; - uint8_t dataType; + uint8_t dataType = expectedType; int status = 0; const uint8_t *p; int bufsize; @@ -127,7 +127,11 @@ static int extract_des(uint8_t *buf, int len, sdp_list_t **svcReqSeq, uint8_t *p return -1; } - dataType = *(uint8_t *)p; + if (dataType == SDP_TYPE_ANY) + expectedType = *p; + + dataType = *p; + SDPDBG("Data type: 0x%02x", dataType); if (expectedType == SDP_TYPE_UUID) { -- cgit