diff options
author | Andrei Emeltchenko <andrei.emeltchenko@intel.com> | 2013-11-25 15:08:51 +0200 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2013-11-25 15:34:15 +0200 |
commit | 1c2efb50934e59713ec223ce0ac55c6ebf554cf3 (patch) | |
tree | d0c7a67e22cee3823160276d3f97941e12a1cc23 /android/hal-utils.c | |
parent | ed7452fbbf1f0cb860f145135139e378e3f14880 (diff) | |
download | bluez-1c2efb50934e59713ec223ce0ac55c6ebf554cf3.tar.gz |
android/hal-utils: Fix possible NULL pointer dereference
Diffstat (limited to 'android/hal-utils.c')
-rw-r--r-- | android/hal-utils.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/android/hal-utils.c b/android/hal-utils.c index 4f44d9892..e3c0c6070 100644 --- a/android/hal-utils.c +++ b/android/hal-utils.c @@ -33,6 +33,9 @@ const char *bt_uuid_t2str(const uint8_t *uuid, char *buf) unsigned int i; int is_bt; + if (!uuid) + return strcpy(buf, "NULL"); + is_bt = !memcmp(&uuid[4], &BT_BASE_UUID[4], HAL_UUID_LEN - 4); for (i = 0; i < HAL_UUID_LEN; i++) { @@ -167,6 +170,9 @@ const char *bt_bdaddr_t2str(const bt_bdaddr_t *bd_addr, char *buf) { const uint8_t *p = bd_addr->address; + if (!bd_addr) + return strcpy(buf, "NULL"); + snprintf(buf, MAX_ADDR_STR_LEN, "%02x:%02x:%02x:%02x:%02x:%02x", p[0], p[1], p[2], p[3], p[4], p[5]); |