Diff between 2be0c6aa3a8ceb38bb21ad376edb817cd947b70f and 401643e5c5528a6d0c372f82b1059fc0e02aed8e

Changed Files

File Additions Deletions Status
attrib/gattrib.c +3 -1 modified

Full Patch

diff --git a/attrib/gattrib.c b/attrib/gattrib.c
index 270a37e..041b9d2 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;
 }