Parcourir la source

[trac998] Catch problem with inet_pton failing with value of -1

Stephen Morris il y a 14 ans
Parent
commit
a90c8a0605
1 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. 2 2
      src/lib/acl/ip_check.h

+ 2 - 2
src/lib/acl/ip_check.h

@@ -238,13 +238,13 @@ public:
             family_ = AF_INET6;
             family_ = AF_INET6;
             int status = inet_pton(AF_INET6, result.first.c_str(),
             int status = inet_pton(AF_INET6, result.first.c_str(),
                                    address_.byte);
                                    address_.byte);
-            if (status == 0) {
+            if (status != 1) {
 
 
                 // Not IPV6, try IPv4
                 // Not IPV6, try IPv4
                 family_ = AF_INET;
                 family_ = AF_INET;
                 int status = inet_pton(AF_INET, result.first.c_str(),
                 int status = inet_pton(AF_INET, result.first.c_str(),
                                        address_.word);
                                        address_.word);
-                if (status == 0) {
+                if (status != 1) {
                     isc_throw(isc::InvalidParameter, "address prefix of " <<
                     isc_throw(isc::InvalidParameter, "address prefix of " <<
                               result.first << " is a not valid");
                               result.first << " is a not valid");
                 }
                 }