提交 3f6b8a61 编写于 作者: M Matthew DeVore 提交者: Junio C Hamano

url: do not read past end of buffer

url_decode_internal could have been tricked into reading past the length
of the **query buffer if there are fewer than 2 characters after a % (in
a null-terminated string, % would have to be the last character).
Prevent this from happening by checking len before decoding the %
sequence.
Helped-by: NRené Scharfe <l.s.r@web.de>
Signed-off-by: NMatthew DeVore <matvore@google.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 aeb582a9
......@@ -46,7 +46,7 @@ static char *url_decode_internal(const char **query, int len,
break;
}
if (c == '%') {
if (c == '%' && (len < 0 || len >= 3)) {
int val = hex2chr(q + 1);
if (0 <= val) {
strbuf_addch(out, val);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册