[PATCH 1/6] android/bluetooth: Fix passing NULL pointer to memcpy

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

 



It is possible to have property with empty value (ie. bonded devices)
so check len before calling memcpy.
---
 android/bluetooth.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/android/bluetooth.c b/android/bluetooth.c
index 4e4397a..70b0849 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -1160,7 +1160,9 @@ static int fill_hal_prop(void *buf, uint8_t type, uint16_t len,
 
 	prop->type = type;
 	prop->len = len;
-	memcpy(prop->val, val, len);
+
+	if (len)
+		memcpy(prop->val, val, len);
 
 	return sizeof(*prop) + len;
 }
-- 
1.9.1

--
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