aboutsummaryrefslogtreecommitdiffstats
path: root/src/url.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2009-03-10 14:20:14 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2009-03-10 14:20:14 +0300
commitdb2aa89316d180d8137f4f8f96b5193fd627e894 (patch)
tree81523aa2f68d9a56deb8677c21806f66ba0b8a41 /src/url.c
parent0f3ffee8009da397270ce1ea127dab84285ed432 (diff)
downloadrspamd-db2aa89316d180d8137f4f8f96b5193fd627e894.tar.gz
rspamd-db2aa89316d180d8137f4f8f96b5193fd627e894.zip
* Fix 2 memory issues:
- NULL string when trying to check url regexp - double free of message byte array as mime_stream frees memory in array if it thinks that stream is owner of array's memory
Diffstat (limited to 'src/url.c')
-rw-r--r--src/url.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/url.c b/src/url.c
index 6a8106b20..c2575f3c8 100644
--- a/src/url.c
+++ b/src/url.c
@@ -859,6 +859,11 @@ url_parse_text (struct worker_task *task, GByteArray *content)
int rc;
char *url_str = NULL;
struct uri *new;
+
+ if (!content->data || content->len == 0) {
+ msg_warn ("url_parse_text: got empty text part");
+ return;
+ }
if (url_init () == 0) {
do {
@@ -905,6 +910,11 @@ url_parse_html (struct worker_task *task, GByteArray *content)
char *url_str = NULL;
struct uri *new;
+ if (!content->data || content->len == 0) {
+ msg_warn ("url_parse_text: got empty text part");
+ return;
+ }
+
if (url_init () == 0) {
do {
rc = g_regex_match_full (html_re, (const char *)content->data, content->len, pos, 0, &info, &err);