From 401643e5c5528a6d0c372f82b1059fc0e02aed8e Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Tue, 21 Dec 2021 12:48:31 -0800 Subject: 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 --- attrib/gattrib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'attrib') 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; } -- cgit v1.2.1