summaryrefslogtreecommitdiff
path: root/attrib
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2021-12-21 12:48:31 -0800
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2021-12-23 11:47:03 -0800
commit401643e5c5528a6d0c372f82b1059fc0e02aed8e (patch)
treed289ea8a1605a8129ff03708e1dbe879c266622a /attrib
parent2be0c6aa3a8ceb38bb21ad376edb817cd947b70f (diff)
downloadbluez-401643e5c5528a6d0c372f82b1059fc0e02aed8e.tar.gz
gattrib: Fix passing NULL to memcpy
This fixes the following runtime error: attrib/gattrib.c:198:2: runtime error: null pointer passed as argument 2, which is declared to never be null
Diffstat (limited to 'attrib')
-rw-r--r--attrib/gattrib.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/attrib/gattrib.c b/attrib/gattrib.c
index 270a37ebe..041b9d289 100644
--- a/attrib/gattrib.c
+++ b/attrib/gattrib.c
@@ -195,7 +195,9 @@ static uint8_t *construct_full_pdu(uint8_t opcode, const void *pdu,
return NULL;
buf[0] = opcode;
- memcpy(buf + 1, pdu, length);
+
+ if (pdu && length)
+ memcpy(buf + 1, pdu, length);
return buf;
}