linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mikel Astiz <mikel.astiz.oss@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Mikel Astiz <mikel.astiz@bmw-carit.de>
Subject: [PATCH BlueZ v0 2/6] network: Fix missing NULL check for given UUID
Date: Mon, 27 May 2013 14:04:05 +0200	[thread overview]
Message-ID: <1369656249-27980-3-git-send-email-mikel.astiz.oss@gmail.com> (raw)
In-Reply-To: <1369656249-27980-1-git-send-email-mikel.astiz.oss@gmail.com>

From: Mikel Astiz <mikel.astiz@bmw-carit.de>

The code dereferences a NULL pointer if find_connection() doesn't find
an existing connection, which will be the case if the input UUID is
invalid or not supported.
---
 profiles/network/connection.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/profiles/network/connection.c b/profiles/network/connection.c
index 84f3dd6..bac3b69 100644
--- a/profiles/network/connection.c
+++ b/profiles/network/connection.c
@@ -426,7 +426,10 @@ static DBusMessage *local_connect(DBusConnection *conn,
 	id = bnep_service_id(svc);
 
 	nc = find_connection(peer->connections, id);
-	if (nc && nc->connect)
+	if (nc == NULL)
+		return btd_error_invalid_args(msg);
+
+	if (nc->connect != NULL)
 		return btd_error_busy(msg);
 
 	err = connection_connect(nc->service);
-- 
1.8.1.4


  parent reply	other threads:[~2013-05-27 12:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-27 12:04 [PATCH BlueZ v0 0/6] Exploit btd_service's userdata pointer Mikel Astiz
2013-05-27 12:04 ` [PATCH BlueZ v0 1/6] network: Remove duplicated search Mikel Astiz
2013-05-27 12:04 ` Mikel Astiz [this message]
2013-05-27 12:04 ` [PATCH BlueZ v0 3/6] network: Remove find_connection() Mikel Astiz
2013-05-27 12:04 ` [PATCH BlueZ v0 4/6] deviceinfo: Use btd_service userdata pointer Mikel Astiz
2013-05-27 12:04 ` [PATCH BlueZ v0 5/6] scanparam: " Mikel Astiz
2013-05-27 12:04 ` [PATCH BlueZ v0 6/6] input: " Mikel Astiz
2013-06-24  8:19 ` [PATCH BlueZ v0 0/6] Exploit btd_service's " 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=1369656249-27980-3-git-send-email-mikel.astiz.oss@gmail.com \
    --to=mikel.astiz.oss@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=mikel.astiz@bmw-carit.de \
    /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).