[PATCH] 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/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Sun Dec 11 20:25:08 UTC 2016


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

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


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/10/1410/1

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: newchange
Gerrit-Change-Id: I6cf195a3fbda1d9eacbbaec9a0e7f5b4c154f428
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list