aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2021-01-05 14:24:09 +0100
committerfixeria <vyanitskiy@sysmocom.de>2021-01-05 15:21:39 +0000
commitd8b7003df7a3a554af22762e150c7201781e0485 (patch)
treee951fff7b07df999ab677cd228bcb80ead602099
parent1c8785dd81211b4adbad7c7da9ebb964bc618496 (diff)
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
-rw-r--r--src/gb/gprs_ns2_sns.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index 027d1daf..2cb42934 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -1556,7 +1556,9 @@ void gprs_ns2_sns_write_vty(struct vty *vty, const struct gprs_ns2_nse *nse)
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);
}
}