[PATCH] android/bluetooth: Fix possible NULL dereference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx>

Since sdp_record_find() may return NULL check this value.
---
 android/bluetooth.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/android/bluetooth.c b/android/bluetooth.c
index aa684bd..ad8af0d 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -1332,6 +1332,7 @@ static void set_device_id(void)
 	struct mgmt_cp_set_device_id cp;
 	uint8_t major, minor;
 	uint16_t version;
+	sdp_record_t *rec;
 
 	if (sscanf(VERSION, "%hhu.%hhu", &major, &minor) != 2)
 		return;
@@ -1351,7 +1352,9 @@ static void set_device_id(void)
 	register_device_id(DEVICE_ID_SOURCE, DEVICE_ID_VENDOR,
 						DEVICE_ID_PRODUCT, version);
 
-	bt_adapter_add_record(sdp_record_find(0x10000), 0x00);
+	rec = sdp_record_find(0x10000);
+	if (rec)
+		bt_adapter_add_record(rec, 0x00);
 }
 
 static void set_adapter_name_complete(uint8_t status, uint16_t length,
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux