summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/urlapi.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/urlapi.c b/lib/urlapi.c
index 903fe1804..1334236b2 100644
--- a/lib/urlapi.c
+++ b/lib/urlapi.c
@@ -598,6 +598,8 @@ static CURLUcode hostname_check(struct Curl_URL *u, char *hostname)
if(hostname[0] == '[') {
char dest[16]; /* fits a binary IPv6 address */
const char *l = "0123456789abcdefABCDEF:.";
+ if(hlen < 5) /* '[::1]' is the shortest possible valid string */
+ return CURLUE_MALFORMED_INPUT;
hostname++;
hlen -= 2;