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

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


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

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


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

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: newchange
Gerrit-Change-Id: Iabfae7e5a880d10e4050da4945200ce9b848e577
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