nwrap: fix numeric port detection in nwrap_getaddrinfo
authorMichael Adam <obnox@samba.org>
Fri, 6 Nov 2015 09:22:10 +0000 (10:22 +0100)
committerMichael Adam <obnox@samba.org>
Fri, 6 Nov 2015 09:22:10 +0000 (10:22 +0100)
Only a string that can be converted to a number, is
allowed as a numeric port specification. Trailing
characters are not allowed.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
src/nss_wrapper.c

index 21fc10810d3f8ac0214397195da3241923f8b51a..5fd3d7b7087e4efea3d13f9b52c812bc831c15b2 100644 (file)
@@ -5085,7 +5085,7 @@ static int nwrap_getaddrinfo(const char *node,
                errno = 0;
                sl = strtol(service, &end_ptr, 10);
 
-               if (*end_ptr == '\0' || end_ptr != service) {
+               if (*end_ptr == '\0') {
                        port = sl;
                        goto valid_port;
                } else if (hints->ai_flags & AI_NUMERICSERV) {