[MERGED] libosmo-sccp[master]: fix NULL deref: sua_accept_cb: missing error-return

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:59:20 UTC 2016


Harald Welte has submitted this change and it was merged.

Change subject: fix NULL deref: sua_accept_cb: missing error-return
......................................................................


fix NULL deref: sua_accept_cb: missing error-return

When server creation failed, besides closing the fd also return an error,
instead of continuing to use the NULL srv.

Change-Id: Iabfae7e5a880d10e4050da4945200ce9b848e577
Fixes: coverity CID#57684
---
M src/sua.c
1 file changed, 3 insertions(+), 1 deletion(-)

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



diff --git a/src/sua.c b/src/sua.c
index 799d270..442b2a0 100644
--- a/src/sua.c
+++ b/src/sua.c
@@ -1261,8 +1261,10 @@
 	srv = osmo_stream_srv_create(user, link, fd,
 				     sua_srv_conn_cb,
 				     sua_srv_conn_closed_cb, NULL);
-	if (!srv)
+	if (!srv) {
 		close(fd);
+		return -1;
+	}
 
 	/* create new SUA link and connect both data structures */
 	sual = sua_link_new(user, 1);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iabfae7e5a880d10e4050da4945200ce9b848e577
Gerrit-PatchSet: 2
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