pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-hnbgw/+/41462?usp=email )
Change subject: hnb: Avoid calling osmo_sock_get_ip_and_port() with negative fd ......................................................................
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(-)
Approvals: fixeria: Looks good to me, but someone else must approve laforge: Looks good to me, but someone else must approve pespin: Looks good to me, approved Jenkins Builder: Verified
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 = "?";