linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Frédéric Danis" <frederic.danis@linux.intel.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH 11/13] adapter: Fix invalid read in conversions
Date: Mon, 17 Dec 2012 16:09:52 +0100	[thread overview]
Message-ID: <1355756994-18953-11-git-send-email-frederic.danis@linux.intel.com> (raw)
In-Reply-To: <1355756994-18953-1-git-send-email-frederic.danis@linux.intel.com>

==8664== Invalid read of size 1
==8664==    at 0x45B214: convert_entry (adapter.c:2325)
==8664==    by 0x456A44: textfile_foreach (textfile.c:464)
==8664==    by 0x45A823: convert_file (adapter.c:2387)
==8664==    by 0x45ABDE: convert_device_storage (adapter.c:2869)
==8664==    by 0x45F6CE: adapter_init (adapter.c:3043)
==8664==    by 0x4594D9: btd_manager_register_adapter (manager.c:176)
==8664==    by 0x46DB3E: mgmt_event.part.38 (mgmt.c:1206)
==8664==    by 0x4E79D52: g_main_context_dispatch (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.3)
==8664==    by 0x4E7A09F: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.3)
==8664==    by 0x4E7A499: g_main_loop_run (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.3)
==8664==    by 0x409D53: main (main.c:513)
==8664==  Address 0x60b99c1 is not stack'd, malloc'd or (recently) free'd
==8664==
---
 src/adapter.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index dd1b0b1..ab86b83 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2204,7 +2204,7 @@ static void convert_entry(char *key, char *value, void *user_data)
 	char *data;
 	gsize length = 0;
 
-	if (key[17] == '#') {
+	if (strchr(key, '#')) {
 		key[17] = '\0';
 		type = key[18] - '0';
 	}
@@ -2446,7 +2446,7 @@ static void convert_primaries_entry(char *key, char *value, void *user_data)
 	char *data;
 	gsize length = 0;
 
-	if (key[17] == '#') {
+	if (strchr(key, '#')) {
 		key[17] = '\0';
 		device_type = key[18] - '0';
 	}
-- 
1.7.9.5


  parent reply	other threads:[~2012-12-17 15:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-17 15:09 [PATCH 01/13] adapter: Add btd_adapter_for_each_device() Frédéric Danis
2012-12-17 15:09 ` [PATCH 02/13] alert: Use ccc file from device storage Frédéric Danis
2012-12-17 15:09 ` [PATCH 03/13] doc: Add device appearance in settings-storage doc Frédéric Danis
2012-12-17 15:09 ` [PATCH 04/13] adapter: Convert appearances file Frédéric Danis
2012-12-17 15:09 ` [PATCH 05/13] device: Load appearance from storage Frédéric Danis
2012-12-17 15:09 ` [PATCH 06/13] adapter: Convert gatt file Frédéric Danis
2012-12-17 15:09 ` [PATCH 07/13] gatt: Use new storage architecture Frédéric Danis
2012-12-17 15:09 ` [PATCH 08/13] adapter: Convert proximity file Frédéric Danis
2012-12-17 15:09 ` [PATCH 09/13] proximity: Use new storage architecture Frédéric Danis
2012-12-17 15:09 ` [PATCH 10/13] adapter: Remove support of pincodes storage file Frédéric Danis
2012-12-17 15:09 ` Frédéric Danis [this message]
2012-12-17 15:09 ` [PATCH 12/13] bluetoothd: Remove storage info from man page Frédéric Danis
2012-12-17 15:09 ` [PATCH 13/13] TODO: Mark convert storage to ini-file item as done Frédéric Danis
2012-12-17 15:54 ` [PATCH 01/13] adapter: Add btd_adapter_for_each_device() 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=1355756994-18953-11-git-send-email-frederic.danis@linux.intel.com \
    --to=frederic.danis@linux.intel.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).