about summary refs log tree commit diff stats
path: root/src/types
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-11-04 21:09:56 +0100
committerbptato <nincsnevem662@gmail.com>2024-11-04 21:10:33 +0100
commita15d056b496587224ebca8e198749f2848e89782 (patch)
tree0e5106c909d648bf6795ae6d06ae6606f018407f /src/types
parent8d22366c3bf67aea31ff746fef56e08944713a13 (diff)
downloadchawan-a15d056b496587224ebca8e198749f2848e89782.tar.gz
url: fix crash on invalid ipv6 syntax
Diffstat (limited to 'src/types')
-rw-r--r--src/types/url.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/types/url.nim b/src/types/url.nim
index 1d546075..fa77f357 100644
--- a/src/types/url.nim
+++ b/src/types/url.nim
@@ -420,7 +420,7 @@ func parseHost(input: string; special: bool): Host =
   if input.len == 0:
     return Host(t: htNone)
   if input[0] == '[':
-    if input[^1] != ']':
+    if input[^1] != ']' or input.len < 3:
       return Host(t: htNone)
     let ipv6 = parseIpv6(input.toOpenArray(1, input.high - 1))
     if ipv6.isNone: