]> granicus.if.org Git - libevent/commitdiff
uri decode: changed the test for the existence of the next character
authorAzat Khuzhin <a3at.mail@gmail.com>
Thu, 28 Feb 2013 19:10:02 +0000 (23:10 +0400)
committerAzat Khuzhin <a3at.mail@gmail.com>
Thu, 28 Feb 2013 19:10:02 +0000 (23:10 +0400)
Fix for 64b6eceaba1a4

More info here
https://github.com/azat/libevent/commit/64b6eceaba1a40ab0b175fa9fd9329d3e978ce6e#commitcomment-2714685

http.c

diff --git a/http.c b/http.c
index ff331e6c0b0b2276ff6655ab20297d5a24b7ca3a..15a035faed10f48c74fe93c3a842f7dd39d09f24 100644 (file)
--- a/http.c
+++ b/http.c
@@ -2889,7 +2889,7 @@ evhttp_decode_uri_internal(
                                decode_plus = 1;
                } else if (c == '+' && decode_plus) {
                        c = ' ';
-               } else if (length > 2 && i < (length - 2) && c == '%' &&
+               } else if ((i + 2) < length && c == '%' &&
                        EVUTIL_ISXDIGIT_(uri[i+1]) && EVUTIL_ISXDIGIT_(uri[i+2])) {
                        char tmp[3];
                        tmp[0] = uri[i+1];