Linux bluetooth development
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Szymon Janc <szymon.janc@tieto.com>
Subject: [PATCH 3/5] android: Fix crash in property_get stub
Date: Thu, 17 Oct 2013 22:28:39 +0200	[thread overview]
Message-ID: <1382041721-19960-3-git-send-email-szymon.janc@gmail.com> (raw)
In-Reply-To: <1382041721-19960-1-git-send-email-szymon.janc@gmail.com>

From: Szymon Janc <szymon.janc@tieto.com>

If value was not found and default_value was not provided NULL pointer
was passed as argument to strncpy resulting in crash.
---
 android/cutils/properties.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/android/cutils/properties.h b/android/cutils/properties.h
index a9f7554..44a712c 100644
--- a/android/cutils/properties.h
+++ b/android/cutils/properties.h
@@ -43,7 +43,7 @@ static inline int property_get(const char *key, char *value,
 	if (!env)
 		env = default_value;
 
-	if (!value)
+	if (!value || !env)
 		return 0;
 
 	strncpy(value, env, PROPERTY_VALUE_MAX);
-- 
1.8.4.rc3


  parent reply	other threads:[~2013-10-17 20:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-17 20:28 [PATCH 1/5] build: Add haltest command line tester Szymon Janc
2013-10-17 20:28 ` [PATCH 2/5] android: Fix haltest build on Linux Szymon Janc
2013-10-17 20:28 ` Szymon Janc [this message]
2013-10-17 20:28 ` [PATCH 4/5] gitignore: Add android/haltest Szymon Janc
2013-10-17 20:28 ` [PATCH 5/5] build: Add missing Android files to EXTRA_DIST Szymon Janc
2013-10-18  7:16 ` [PATCH 1/5] build: Add haltest command line tester 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=1382041721-19960-3-git-send-email-szymon.janc@gmail.com \
    --to=szymon.janc@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=szymon.janc@tieto.com \
    /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