apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject svn commit: r1808039 - in /apr/apr/trunk: network_io/unix/sockaddr.c test/testipsub.c
Date Mon, 11 Sep 2017 14:57:08 GMT
Author: jorton
Date: Mon Sep 11 14:57:08 2017
New Revision: 1808039

URL: http://svn.apache.org/viewvc?rev=1808039&view=rev
Log:
* network_io/unix/sockaddr.c (looks_like_ip): Fail for the empty
  string.

* test/testipsub.c: Test that calling apr_ipsubnet_create with the
  empty string fails.

Modified:
    apr/apr/trunk/network_io/unix/sockaddr.c
    apr/apr/trunk/test/testipsub.c

Modified: apr/apr/trunk/network_io/unix/sockaddr.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/network_io/unix/sockaddr.c?rev=1808039&r1=1808038&r2=1808039&view=diff
==============================================================================
--- apr/apr/trunk/network_io/unix/sockaddr.c (original)
+++ apr/apr/trunk/network_io/unix/sockaddr.c Mon Sep 11 14:57:08 2017
@@ -1053,6 +1053,10 @@ static apr_status_t parse_ip(apr_ipsubne
 
 static int looks_like_ip(const char *ipstr)
 {
+    if (strlen(ipstr) == 0) {
+        return 0;
+    }
+    
     if (strchr(ipstr, ':')) {
         /* definitely not a hostname; assume it is intended to be an IPv6 address */
         return 1;

Modified: apr/apr/trunk/test/testipsub.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/testipsub.c?rev=1808039&r1=1808038&r2=1808039&view=diff
==============================================================================
--- apr/apr/trunk/test/testipsub.c (original)
+++ apr/apr/trunk/test/testipsub.c Mon Sep 11 14:57:08 2017
@@ -45,6 +45,7 @@ static void test_bad_input(abts_case *tc
         ,{"127.0.0.1.2",       NULL,               APR_EBADIP}
         ,{"127.0.0.1.2",       "8",                APR_EBADIP}
         ,{"127",               "255.0.0.0",        APR_EBADIP} /* either EBADIP or EBADMASK
seems fine */
+        ,{"",                  NULL,               APR_EBADIP}
 #if APR_HAVE_IPV6
         ,{"::1",               NULL,               APR_SUCCESS}
         ,{"::1",               "20",               APR_SUCCESS}



Mime
View raw message