aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-10-15 15:30:54 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-10-15 15:30:54 +0100
commit8407683f7764e7fdb9fdeb84899a90483680a066 (patch)
tree6d1fd7dca0a6dfc8478bfe81c7a6ad16dda36f75 /src
parent3518e0293d3a77ae8b3c3aca93b276920fa6919c (diff)
downloadrspamd-8407683f7764e7fdb9fdeb84899a90483680a066.tar.gz
rspamd-8407683f7764e7fdb9fdeb84899a90483680a066.zip
Do not check out of boundary memory.
Diffstat (limited to 'src')
-rw-r--r--src/libutil/http.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libutil/http.c b/src/libutil/http.c
index e082c3c24..9c08f41f8 100644
--- a/src/libutil/http.c
+++ b/src/libutil/http.c
@@ -2420,7 +2420,7 @@ rspamd_http_message_parse_query (struct rspamd_http_message *msg)
while (p <= end) {
switch (state) {
case parse_key:
- if ((*p == '&' || p == end) && p > c) {
+ if ((p == end || *p == '&') && p > c) {
/* We have a single parameter without a value */
key = rspamd_fstring_new_init (c, p - c);
key_tok = rspamd_ftok_map (key);
@@ -2458,7 +2458,7 @@ rspamd_http_message_parse_query (struct rspamd_http_message *msg)
break;
case parse_value:
- if ((*p == '&' || p == end) && p >= c) {
+ if ((p == end || *p == '&') && p >= c) {
g_assert (key != NULL);
if (p > c) {
value = rspamd_fstring_new_init (c, p - c);
@@ -2483,7 +2483,7 @@ rspamd_http_message_parse_query (struct rspamd_http_message *msg)
break;
case parse_ampersand:
- if (*p != '&' && p != end) {
+ if (p != end && *p != '&') {
c = p;
state = parse_key;
}