diff --git a/lib/urlapi.c b/lib/urlapi.c index 91f615c3b..be27b0233 100644 --- a/lib/urlapi.c +++ b/lib/urlapi.c @@ -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. */ }