linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Elvis Pfützenreuter" <epx@signove.com>
To: linux-bluetooth@vger.kernel.org
Cc: epx@signove.com
Subject: [PATCH] Fixes sdp_get_supp_feat function
Date: Wed, 16 Jun 2010 13:30:48 -0300	[thread overview]
Message-ID: <1276705848-22401-1-git-send-email-epx@signove.com> (raw)

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


             reply	other threads:[~2010-06-16 16:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-16 16:30 Elvis Pfützenreuter [this message]
2010-06-18  8:14 ` [PATCH] Fixes sdp_get_supp_feat function Johan Hedberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1276705848-22401-1-git-send-email-epx@signove.com \
    --to=epx@signove.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).