summaryrefslogtreecommitdiff
path: root/android/hal-utils.c
diff options
context:
space:
mode:
authorGowtham Anandha Babu <gowtham.ab@samsung.com>2014-09-11 18:50:07 +0530
committerSzymon Janc <szymon.janc@tieto.com>2014-09-19 08:52:22 +0200
commite2eed50f50bdbe01b1470b2cec5c1135548c14c3 (patch)
tree85112a8ded6ef8baa0049a25bd81570a4c6aca7c /android/hal-utils.c
parentaf6cb38c2dd9b6f966fdc0c800b183d4b9fd9355 (diff)
downloadbluez-e2eed50f50bdbe01b1470b2cec5c1135548c14c3.tar.gz
android/hal-utils: Fix null pointer dereference
Handles the possible null pointer dereference: bd_addr by checking it against null.
Diffstat (limited to 'android/hal-utils.c')
-rw-r--r--android/hal-utils.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/android/hal-utils.c b/android/hal-utils.c
index ceefefc66..64ab5a1d9 100644
--- a/android/hal-utils.c
+++ b/android/hal-utils.c
@@ -166,11 +166,13 @@ int int2str_findstr(const char *str, const struct int2str m[])
*/
const char *bt_bdaddr_t2str(const bt_bdaddr_t *bd_addr, char *buf)
{
- const uint8_t *p = bd_addr->address;
+ const uint8_t *p;
if (!bd_addr)
return strcpy(buf, "NULL");
+ p = bd_addr->address;
+
snprintf(buf, MAX_ADDR_STR_LEN, "%02x:%02x:%02x:%02x:%02x:%02x",
p[0], p[1], p[2], p[3], p[4], p[5]);