[PATCH] libosmocore[master]: lapd_test: avoid calling memcpy with NULL source

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed Jan 4 10:25:50 UTC 2017


Review at  https://gerrit.osmocom.org/1531

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
---
M tests/lapd/lapd_test.c
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/31/1531/1

diff --git a/tests/lapd/lapd_test.c b/tests/lapd/lapd_test.c
index 18ea1dc..e322314 100644
--- a/tests/lapd/lapd_test.c
+++ b/tests/lapd/lapd_test.c
@@ -51,7 +51,8 @@
 {
 	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;
 }
 

-- 
To view, visit https://gerrit.osmocom.org/1531
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7030729f4f4c867adecc7afc15bb5ca9beff0030
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list