lapd_test: avoid calling memcpy with NULL source

fixes
lapd/lapd_test.c:54:2: runtime error: null pointer passed as argument 2, which is declared to never be null

Change-Id: I7030729f4f4c867adecc7afc15bb5ca9beff0030
This commit is contained in:
Harald Welte 2017-01-04 11:18:59 +01:00
parent 6cfa56ba0c
commit 53e2672e11
1 changed files with 2 additions and 1 deletions

View File

@ -51,7 +51,8 @@ static struct msgb *msgb_from_array(const uint8_t *data, int len)
{
struct msgb *msg = msgb_alloc_headroom(4096, 128, "data");
msg->l3h = msgb_put(msg, len);
memcpy(msg->l3h, data, len);
if (data && len)
memcpy(msg->l3h, data, len);
return msg;
}