Skip to content

Commit d37dc23

Browse files
matvoregitster
authored andcommitted
url: do not allow %00 to represent NUL in URLs
There is no reason to allow %00 to terminate a string, so do not allow it. Otherwise, we end up returning arbitrary content in the string (that which is after the %00) which is effectively hidden from callers and can escape sanity checks and validation, and possible be used in tandem with a security vulnerability to introduce a payload. Helped-by: brian m. carlson <[email protected]> Signed-off-by: Matthew DeVore <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3f6b8a6 commit d37dc23

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

url.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ static char *url_decode_internal(const char **query, int len,
4848

4949
if (c == '%' && (len < 0 || len >= 3)) {
5050
int val = hex2chr(q + 1);
51-
if (0 <= val) {
51+
if (0 < val) {
5252
strbuf_addch(out, val);
5353
q += 3;
5454
len -= 3;

0 commit comments

Comments
 (0)