Fix evhttp_uriencode() regression.

http_uriencode_test() (in test/regress_http.c) has been failed after
72afe4c as "hello\0world" is encoded to "hello" instead of
"hello%00world". This is because of a misplaced overflow check which
causes the non-negative "size" specified in parameter being ignored in
within-bound URI.

Fixes: #392
This commit is contained in:
Zonr Chang 2016-08-24 17:16:32 +08:00 committed by Azat Khuzhin
parent e94250c8e3
commit c6b1ec1220

2
http.c
View File

@ -3079,7 +3079,7 @@ evhttp_uriencode(const char *uri, ev_ssize_t len, int space_as_plus)
}
if (len >= 0 && uri + len < uri) {
if (len >= 0) {
if (uri + len < uri) {
return (NULL);
}