From 9b983bdd9597a67afe437ee59ebb6e2488aa9bf0 Mon Sep 17 00:00:00 2001 From: Dialga Date: Sat, 4 Sep 2021 23:57:09 +1200 Subject: [PATCH] net.urllib: fix double free in escape() (#11390) --- vlib/net/urllib/urllib.v | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/vlib/net/urllib/urllib.v b/vlib/net/urllib/urllib.v index 3b02ef674e..30480f4357 100644 --- a/vlib/net/urllib/urllib.v +++ b/vlib/net/urllib/urllib.v @@ -272,14 +272,8 @@ fn escape(s string, mode EncodingMode) string { if space_count == 0 && hex_count == 0 { return s } - buf := []byte{len: (64)} - mut t := []byte{} required := s.len + 2 * hex_count - if required <= buf.len { - t = buf[..required] - } else { - t = []byte{len: required} - } + mut t := []byte{len: required} if hex_count == 0 { copy(t, s.bytes()) for i in 0 .. s.len {