linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fixes sdp_get_supp_feat function
@ 2010-06-16 16:30 Elvis Pfützenreuter
  2010-06-18  8:14 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Elvis Pfützenreuter @ 2010-06-16 16:30 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: epx

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fixes sdp_get_supp_feat function
  2010-06-16 16:30 [PATCH] Fixes sdp_get_supp_feat function Elvis Pfützenreuter
@ 2010-06-18  8:14 ` Johan Hedberg
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2010-06-18  8:14 UTC (permalink / raw)
  To: Elvis Pfützenreuter; +Cc: linux-bluetooth

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-06-18  8:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-16 16:30 [PATCH] Fixes sdp_get_supp_feat function Elvis Pfützenreuter
2010-06-18  8:14 ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).