Merge branch 'md/url-parse-harden'
The URL decoding code has been updated to avoid going past the end of the string while parsing %-<hex>-<hex> sequence. * md/url-parse-harden: url: do not allow %00 to represent NUL in URLs url: do not read past end of buffer
This commit is contained in:
commit
f9089e8491
4
url.c
4
url.c
@ -46,9 +46,9 @@ static char *url_decode_internal(const char **query, int len,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == '%') {
|
if (c == '%' && (len < 0 || len >= 3)) {
|
||||||
int val = hex2chr(q + 1);
|
int val = hex2chr(q + 1);
|
||||||
if (0 <= val) {
|
if (0 < val) {
|
||||||
strbuf_addch(out, val);
|
strbuf_addch(out, val);
|
||||||
q += 3;
|
q += 3;
|
||||||
len -= 3;
|
len -= 3;
|
||||||
|
Loading…
Reference in New Issue
Block a user