From d185cebba153a26e359fd2ca326971a118014d0e Mon Sep 17 00:00:00 2001 From: Chris Darroch Date: Mon, 7 May 2018 23:42:33 -0700 Subject: [PATCH] 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. --- src/main/radwho.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/radwho.c b/src/main/radwho.c index 4ea9846649c0..7f2ce6dbf444 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;