summaryrefslogtreecommitdiff
path: root/ext/socket/getnameinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/socket/getnameinfo.c')
-rw-r--r--ext/socket/getnameinfo.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/socket/getnameinfo.c b/ext/socket/getnameinfo.c
index d1d5ff6..d0c17e1 100644
--- a/ext/socket/getnameinfo.c
+++ b/ext/socket/getnameinfo.c
@@ -151,8 +151,8 @@ getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, socklen_t ho
if (sa == NULL)
return ENI_NOSOCKET;
- len = SA_LEN(sa);
- if (len != salen) return ENI_SALEN;
+ if (!VALIDATE_SOCKLEN(sa, salen)) return ENI_SALEN;
+ len = salen;
family = sa->sa_family;
for (i = 0; afdl[i].a_af; i++)