Change in libosmocore[master]: gprs_ns2_sns: always check rc of osmo_sockaddr_str_from_sockaddr()

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/.

fixeria gerrit-no-reply at lists.osmocom.org
Tue Jan 5 13:27:30 UTC 2021


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/21944 )


Change subject: gprs_ns2_sns: always check rc of osmo_sockaddr_str_from_sockaddr()
......................................................................

gprs_ns2_sns: always check rc of osmo_sockaddr_str_from_sockaddr()

Writing a configuration that will be rejected by the VTY parser
is not the best solution, but still better than printing values
from previous iterations or the stack garbage.  In any case,
this is unlikely to happen, just making Coverity happy.

Change-Id: I26644fe544c82c90767ec1a9709918474bd1be53
Fixes: CID#215852
---
M src/gb/gprs_ns2_sns.c
1 file changed, 3 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/44/21944/1

diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index 027d1da..2cb4293 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -1556,7 +1556,9 @@
 
 	gss = (struct ns2_sns_state *) nse->bss_sns_fi->priv;
 	llist_for_each_entry(endpoint, &gss->sns_endpoints, list) {
-		osmo_sockaddr_str_from_sockaddr(&addr_str, &endpoint->saddr.u.sas);
+		/* It's unlikely that an error happens, but let's better be safe. */
+		if (osmo_sockaddr_str_from_sockaddr(&addr_str, &endpoint->saddr.u.sas) != 0)
+			addr_str = (struct osmo_sockaddr_str) { .ip = "<INVALID>" };
 		vty_out(vty, "  ip-sns %s %u%s", addr_str.ip, addr_str.port, VTY_NEWLINE);
 	}
 }

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/21944
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I26644fe544c82c90767ec1a9709918474bd1be53
Gerrit-Change-Number: 21944
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210105/0473dd01/attachment.htm>


More information about the gerrit-log mailing list