pespin has uploaded this change for review.
hnb: Avoid calling osmo_sock_get_ip_and_port() with negative fd
Related: Coverity CID#551438
Change-Id: I3ff5d17cd42393893a507718ee191af40bb2499b
---
M src/osmo-hnbgw/hnb.c
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-hnbgw refs/changes/62/41462/1
diff --git a/src/osmo-hnbgw/hnb.c b/src/osmo-hnbgw/hnb.c
index bd6b02c..88c64f6 100644
--- a/src/osmo-hnbgw/hnb.c
+++ b/src/osmo-hnbgw/hnb.c
@@ -132,7 +132,7 @@
int fd = osmo_stream_srv_get_fd(ctx->conn);
/* get remote addr */
- if (osmo_sock_get_ip_and_port(fd, hostbuf_r, sizeof(hostbuf_r), portbuf_r, sizeof(portbuf_r), false) == 0)
+ if (fd >= 0 && osmo_sock_get_ip_and_port(fd, hostbuf_r, sizeof(hostbuf_r), portbuf_r, sizeof(portbuf_r), false) == 0)
result = talloc_asprintf(OTC_SELECT, "%s:%s", hostbuf_r, portbuf_r);
else
result = "?";
To view, visit change 41462. To unsubscribe, or for help writing mail filters, visit settings.