pespin has uploaded this change for review. ( 
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(-)



  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 https://gerrit.osmocom.org/c/osmo-hnbgw/+/41462?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: osmo-hnbgw
Gerrit-Branch: master
Gerrit-Change-Id: I3ff5d17cd42393893a507718ee191af40bb2499b
Gerrit-Change-Number: 41462
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>

Reply via email to