summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-01-04 11:18:59 +0100
committerHarald Welte <laforge@gnumonks.org>2017-01-06 10:03:30 +0000
commit53e2672e1169883983cd3efba3ced2d644ad4ffa (patch)
treecacf57154191ebfc231a32796421c603f54073df
parent6cfa56ba0c887d63c40efbab369541681f13fe21 (diff)
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
-rw-r--r--tests/lapd/lapd_test.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/lapd/lapd_test.c b/tests/lapd/lapd_test.c
index 18ea1dc3..e3223143 100644
--- a/tests/lapd/lapd_test.c
+++ b/tests/lapd/lapd_test.c
@@ -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;
}