diff --git a/http.c b/http.c index ff331e6c..15a035fa 100644 --- 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];