From 02225cd8fb9a983814a8ae4d3e22b760bb7cec69 Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Fri, 11 Apr 2014 09:41:22 +0200 Subject: [PATCH] android/bluetooth: Fix passing NULL pointer to memcpy 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 dfc929dae..8e41361ca 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; } -- 2.47.3