]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
urlapi: avoid null deref if setting blank host to url encode
authorDaniel Stenberg <daniel@haxx.se>
Tue, 31 Oct 2023 10:24:13 +0000 (11:24 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 1 Nov 2023 09:55:46 +0000 (10:55 +0100)
Reported-by: kirbyn17 on hackerone
Closes #12240

lib/urlapi.c

index 91f615c3bc34db9d0e27cd91ec5964206d913f6a..be27b02332419cf7e0a1570bf4be5e5635285d61 100644 (file)
@@ -1931,8 +1931,8 @@ nomem:
       }
     }
 
-    if(what == CURLUPART_HOST) {
-      size_t n = strlen(newp);
+    else if(what == CURLUPART_HOST) {
+      size_t n = Curl_dyn_len(&enc);
       if(!n && (flags & CURLU_NO_AUTHORITY)) {
         /* Skip hostname check, it's allowed to be empty. */
       }