gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnurl] 175/219: urlapi: require a non-zero host name lengt


From: gnunet
Subject: [GNUnet-SVN] [gnurl] 175/219: urlapi: require a non-zero host name length when parsing URL
Date: Wed, 22 May 2019 19:18:34 +0200

This is an automated email from the git hooks/post-receive script.

ng0 pushed a commit to branch master
in repository gnurl.

commit 9f9ec7da570bf1468eafe611023627c9a2b0b5d2
Author: Daniel Stenberg <address@hidden>
AuthorDate: Mon May 13 18:42:05 2019 +0200

    urlapi: require a non-zero host name length when parsing URL
    
    Updated test 1560 to verify.
    
    Closes #3880
---
 lib/urlapi.c            | 2 ++
 tests/libtest/lib1560.c | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/lib/urlapi.c b/lib/urlapi.c
index c66c07f0a..0d05f4d92 100644
--- a/lib/urlapi.c
+++ b/lib/urlapi.c
@@ -636,6 +636,8 @@ static CURLUcode hostname_check(struct Curl_URL *u, char 
*hostname)
       /* hostname with bad content */
       return CURLUE_MALFORMED_INPUT;
   }
+  if(!hostname[0])
+    return CURLUE_NO_HOST;
   return CURLUE_OK;
 }
 
diff --git a/tests/libtest/lib1560.c b/tests/libtest/lib1560.c
index 5ad7134d0..a18d56a8e 100644
--- a/tests/libtest/lib1560.c
+++ b/tests/libtest/lib1560.c
@@ -140,6 +140,9 @@ static struct testcase get_parts_list[] ={
    "file | [11] | [12] | [13] | [14] | [15] | C:\\programs\\foo | [16] | [17]",
    CURLU_DEFAULT_SCHEME, 0, CURLUE_OK},
 #endif
+  /* URL without host name */
+  {"http://a:b@/x";, "",
+   CURLU_DEFAULT_SCHEME, 0, CURLUE_NO_HOST},
   {"boing:80",
    "https | [11] | [12] | [13] | boing | 80 | / | [16] | [17]",
    CURLU_DEFAULT_SCHEME, 0, CURLUE_OK},

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]