[MERGED] libosmo-sccp[master]: NULL safety: sccp_create_sccp_addr: copy only non-NULL sock-...

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
Mon Dec 12 10:58:55 UTC 2016


Harald Welte has submitted this change and it was merged.

Change subject: NULL safety: sccp_create_sccp_addr: copy only non-NULL sock->gti
......................................................................


NULL safety: sccp_create_sccp_addr: copy only non-NULL sock->gti

presumably, sock->gti_len is always zero when sock->gti is NULL, but ensure
with a check and make coverity scan happy.

Change-Id: I6cf195a3fbda1d9eacbbaec9a0e7f5b4c154f428
Fixes: coverity CID#57683
---
M src/sccp.c
1 file changed, 4 insertions(+), 2 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/sccp.c b/src/sccp.c
index e6c538d..6c77cc4 100644
--- a/src/sccp.c
+++ b/src/sccp.c
@@ -510,8 +510,10 @@
 	msgb_v_put(msg, sock->sccp_ssn);
 
 	/* copy the gti if it is present */
-	gti = msgb_put(msg, sock->gti_len);
-	memcpy(gti, sock->gti, sock->gti_len);
+	if (sock->gti) {
+		gti = msgb_put(msg, sock->gti_len);
+		memcpy(gti, sock->gti, sock->gti_len);
+	}
 
 	/* update the length now */
 	len[0] = msg->tail - len - 1;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I6cf195a3fbda1d9eacbbaec9a0e7f5b4c154f428
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list