diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-12-02 12:59:20 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-12-02 12:59:20 +0000 |
commit | 517d609ee2a1cac40858d39bef68b726dbcc5f15 (patch) | |
tree | 4cbc56dfff43a13967f0768c3eb1b96031363876 /src/libserver | |
parent | 7815be9c25f95a04a3f530da8724c5c9eb15952e (diff) | |
download | rspamd-517d609ee2a1cac40858d39bef68b726dbcc5f15.tar.gz rspamd-517d609ee2a1cac40858d39bef68b726dbcc5f15.zip |
[Fix] Fix length calculations for url encoded urls
Diffstat (limited to 'src/libserver')
-rw-r--r-- | src/libserver/url.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libserver/url.c b/src/libserver/url.c index d05f04081..507913413 100644 --- a/src/libserver/url.c +++ b/src/libserver/url.c @@ -789,7 +789,6 @@ rspamd_web_parse (struct http_parser_url *u, const gchar *str, gsize len, if (p - c == 0) { goto out; } - SET_U (u, UF_USERINFO); st = parse_password_start; } else if (t == '@') { @@ -808,6 +807,7 @@ rspamd_web_parse (struct http_parser_url *u, const gchar *str, gsize len, case parse_password_start: if (t == '@') { /* Empty password */ + SET_U (u, UF_USERINFO); st = parse_at; } else { @@ -819,6 +819,7 @@ rspamd_web_parse (struct http_parser_url *u, const gchar *str, gsize len, case parse_password: if (t == '@') { /* XXX: password is not stored */ + SET_U (u, UF_USERINFO); st = parse_at; } else if (!g_ascii_isgraph (t)) { @@ -1353,6 +1354,7 @@ rspamd_url_shift (struct rspamd_url *uri, gsize nlen, uri->protocollen -= shift; memmove (uri->string + uri->protocollen, uri->string + old_shift, uri->urllen - uri->protocollen); + uri->urllen -= shift; break; case UF_HOST: if (nlen >= uri->hostlen) { @@ -1366,6 +1368,7 @@ rspamd_url_shift (struct rspamd_url *uri, gsize nlen, uri->hostlen -= shift; memmove (uri->host + uri->hostlen, uri->host + old_shift, uri->datalen + uri->querylen + uri->fragmentlen); + uri->urllen -= shift; break; case UF_PATH: if (nlen >= uri->datalen) { @@ -1379,6 +1382,7 @@ rspamd_url_shift (struct rspamd_url *uri, gsize nlen, uri->datalen -= shift; memmove (uri->data + uri->datalen, uri->data + old_shift, uri->querylen + uri->fragmentlen); + uri->urllen -= shift; break; case UF_QUERY: if (nlen >= uri->querylen) { @@ -1392,6 +1396,7 @@ rspamd_url_shift (struct rspamd_url *uri, gsize nlen, uri->querylen -= shift; memmove (uri->query + uri->querylen, uri->query + old_shift, uri->fragmentlen); + uri->urllen -= shift; break; case UF_FRAGMENT: if (nlen >= uri->fragmentlen) { @@ -1402,6 +1407,7 @@ rspamd_url_shift (struct rspamd_url *uri, gsize nlen, } uri->fragmentlen -= shift; + uri->urllen -= shift; break; default: break; |