From: Chris Darroch Date: Tue, 8 May 2018 06:42:33 +0000 (-0700) Subject: Print usage and exit when -N used with invalid IP. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d185cebba153a26e359fd2ca326971a118014d0e;p=thirdparty%2Ffreeradius-server.git Print usage and exit when -N used with invalid IP. Check for all possible error return values from inet_pton(), particularly zero, as this indicates an invalid IP address was passed in the input string, whereas -1 is returned only when the address family parameter is invalid, which is never the case here because it's always AF_INET. --- diff --git a/src/main/radwho.c b/src/main/radwho.c index 4ea9846649c..7f2ce6dbf44 100644 --- a/src/main/radwho.c +++ b/src/main/radwho.c @@ -233,7 +233,7 @@ int main(int argc, char **argv) showname = 0; break; case 'N': - if (inet_pton(AF_INET, optarg, &nas_ip_address) < 0) { + if (inet_pton(AF_INET, optarg, &nas_ip_address) <= 0) { usage(1); } break;