summaryrefslogtreecommitdiff
path: root/http.c
diff options
context:
space:
mode:
authorAzat Khuzhin <a3at.mail@gmail.com>2013-02-28 17:19:44 +0400
committerAzat Khuzhin <a3at.mail@gmail.com>2013-02-28 17:19:44 +0400
commit64b6eceaba1a40ab0b175fa9fd9329d3e978ce6e (patch)
tree80746f978d8d35dffac40b405122cebdca48c428 /http.c
parent87c56727b61e48c102d21f1bb6477de8ec001869 (diff)
downloadlibevent-64b6eceaba1a40ab0b175fa9fd9329d3e978ce6e.tar.gz
uri decode: fix for warning "use of uninitialised value"
This patch add check in evhttp_decode_uri_internal() that next 2 symbols are exists in array of chars for decoding, if don't have two next 2 symbols don't try to decode '%FF'
Diffstat (limited to 'http.c')
-rw-r--r--http.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/http.c b/http.c
index b94fed8c..ff331e6c 100644
--- a/http.c
+++ b/http.c
@@ -2889,8 +2889,8 @@ evhttp_decode_uri_internal(
decode_plus = 1;
} else if (c == '+' && decode_plus) {
c = ' ';
- } else if (c == '%' && EVUTIL_ISXDIGIT_(uri[i+1]) &&
- EVUTIL_ISXDIGIT_(uri[i+2])) {
+ } else if (length > 2 && i < (length - 2) && c == '%' &&
+ EVUTIL_ISXDIGIT_(uri[i+1]) && EVUTIL_ISXDIGIT_(uri[i+2])) {
char tmp[3];
tmp[0] = uri[i+1];
tmp[1] = uri[i+2];