[MERGED] 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
Fri Jan 6 10:03:35 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: lapd_test: avoid calling memcpy with NULL source
......................................................................


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(-)

Approvals:
  Max: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



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: merged
Gerrit-Change-Id: I7030729f4f4c867adecc7afc15bb5ca9beff0030
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list