linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH obexd] client: fix parsing of apparam on pbap driver
Date: Tue, 17 Jan 2012 12:15:09 +0200	[thread overview]
Message-ID: <1326795309-27078-1-git-send-email-luiz.dentz@gmail.com> (raw)

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Both hdr and size need to be updated otherwise no parameters will be
parsed.
---
 client/pbap.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/client/pbap.c b/client/pbap.c
index 9e9eb05..84465ac 100644
--- a/client/pbap.c
+++ b/client/pbap.c
@@ -364,8 +364,8 @@ static void read_return_apparam(struct obc_session *session,
 {
 	struct obc_transfer *transfer = obc_session_get_transfer(session);
 	struct obc_transfer_params params;
-	unsigned char *buf;
-	size_t size = 0;
+	struct apparam_hdr *hdr;
+	size_t size;
 
 	*phone_book_size = 0;
 	*new_missed_calls = 0;
@@ -376,9 +376,10 @@ static void read_return_apparam(struct obc_session *session,
 	if (params.size < APPARAM_HDR_SIZE)
 		return;
 
-	while (size > APPARAM_HDR_SIZE) {
-		struct apparam_hdr *hdr = (struct apparam_hdr *) params.data;
+	hdr = (struct apparam_hdr *) params.data;
+	size = params.size;
 
+	while (size > APPARAM_HDR_SIZE) {
 		if (hdr->len > size - APPARAM_HDR_SIZE) {
 			error("Unexpected PBAP pullphonebook app"
 					" length, tag %d, len %d",
@@ -404,7 +405,7 @@ static void read_return_apparam(struct obc_session *session,
 					hdr->tag, hdr->len);
 		}
 
-		buf += APPARAM_HDR_SIZE + hdr->len;
+		hdr += APPARAM_HDR_SIZE + hdr->len;
 		size -= APPARAM_HDR_SIZE + hdr->len;
 	}
 }
-- 
1.7.7.5


             reply	other threads:[~2012-01-17 10:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-17 10:15 Luiz Augusto von Dentz [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-01-14  9:53 [PATCH obexd] client: fix parsing of apparam on pbap driver Luiz Augusto von Dentz
2012-01-16 14:52 ` Syam Sidhardhan
2012-01-16 15:02   ` Luiz Augusto von Dentz

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=1326795309-27078-1-git-send-email-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.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).