2010-06-16 16:30:48

by Elvis Pfutzenreuter

[permalink] [raw]
Subject: [PATCH] Fixes sdp_get_supp_feat function

In case of string data items, value is a pointer by itself.
---
lib/sdp.c | 25 ++++++++++++++++++++++---
1 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/lib/sdp.c b/lib/sdp.c
index 79f4ae5..17745ac 100644
--- a/lib/sdp.c
+++ b/lib/sdp.c
@@ -4769,13 +4769,32 @@ int sdp_get_supp_feat(const sdp_record_t *rec, sdp_list_t **seqp)

if (d->dtd < SDP_SEQ8 || d->dtd > SDP_SEQ32)
goto fail;
+
subseq = NULL;
+
for (dd = d->val.dataseq; dd; dd = dd->next) {
sdp_data_t *data;
- if (dd->dtd != SDP_UINT8 && dd->dtd != SDP_UINT16 &&
- dd->dtd != SDP_TEXT_STR8)
+ void *val;
+ int length;
+
+ switch (dd->dtd) {
+ case SDP_URL_STR8:
+ case SDP_URL_STR16:
+ case SDP_TEXT_STR8:
+ case SDP_TEXT_STR16:
+ val = dd->val.str;
+ length = dd->unitSize - sizeof(uint8_t);
+ break;
+ case SDP_UINT8:
+ case SDP_UINT16:
+ val = &dd->val;
+ length = 0;
+ break;
+ default:
goto fail;
- data = sdp_data_alloc(dd->dtd, &dd->val);
+ }
+
+ data = sdp_data_alloc_with_length(dd->dtd, val, length);
if (data)
subseq = sdp_list_append(subseq, data);
}
--
1.7.0.4



2010-06-18 08:14:07

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH] Fixes sdp_get_supp_feat function

Hi Elvis,

On Wed, Jun 16, 2010, Elvis Pf?tzenreuter wrote:
> In case of string data items, value is a pointer by itself.
> ---
> lib/sdp.c | 25 ++++++++++++++++++++++---
> 1 files changed, 22 insertions(+), 3 deletions(-)

The patch is now upstream. Thanks.

Johan