diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2021-12-21 12:48:31 -0800 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2021-12-23 11:47:03 -0800 |
commit | 401643e5c5528a6d0c372f82b1059fc0e02aed8e (patch) | |
tree | d289ea8a1605a8129ff03708e1dbe879c266622a /attrib | |
parent | 2be0c6aa3a8ceb38bb21ad376edb817cd947b70f (diff) | |
download | bluez-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.c | 4 |
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; } |