summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2016-01-27 15:54:29 +0100
committerLemonBoy <thatlemon@gmail.com>2016-01-27 15:54:29 +0100
commit118eb0a68ce3250aa4528e6086b2bd0567e7638c (patch)
tree72c50c6702ed40f037ece60544690534918131bb /src
parentf31b2026b4732e57f88af14796ac0dea4b2d0131 (diff)
downloadirssi-118eb0a68ce3250aa4528e6086b2bd0567e7638c.zip
Call getnameinfo with NI_NAMEREQD flag.
This way net_gethostbyaddr will fail when the system is unable to resolve the address to a valid host name. Without this flag in case of failure the function would return the ip address instead of failing.
Diffstat (limited to 'src')
-rw-r--r--src/core/network.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/core/network.c b/src/core/network.c
index 28189661..8abc1ba1 100644
--- a/src/core/network.c
+++ b/src/core/network.c
@@ -447,8 +447,10 @@ int net_gethostbyaddr(IPADDR *ip, char **name)
sin_set_ip(&so, ip);
/* save error to host_error for later use */
- host_error = getnameinfo((struct sockaddr *) &so, sizeof(so),
- hostname, sizeof(hostname), NULL, 0, 0);
+ host_error = getnameinfo((struct sockaddr *)&so, sizeof(so),
+ hostname, sizeof(hostname),
+ NULL, 0,
+ NI_NAMEREQD);
if (host_error != 0)
return host_error;