From: Zonr Chang Date: Wed, 24 Aug 2016 09:16:32 +0000 (+0800) Subject: Fix evhttp_uriencode() regression. X-Git-Tag: release-2.1.6-beta~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c6b1ec1220bf5b4d33b1011534bdef75fd6183be;p=libevent 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 --- diff --git a/http.c b/http.c index 6fee8702..b9f909e4 100644 --- a/http.c +++ b/http.c @@ -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); }