]> source.dussan.org Git - rspamd.git/commitdiff
* Fix html decoding when '/' are encoded too
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Fri, 28 Aug 2009 11:22:26 +0000 (15:22 +0400)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Fri, 28 Aug 2009 11:22:26 +0000 (15:22 +0400)
src/html.c

index 8f5664079fc1a5a5e5686d828ad0a1fa5afd503e..5560f920a4d17a728ddf30eef062b7118be0075b 100644 (file)
@@ -303,7 +303,7 @@ decode_entitles (char *s)
                                        else {
                                                val = strtoul ((e + 3), &end_ptr, base);
                                        }
-                                       if ((end_ptr != NULL && *end_ptr != ';') || !g_ascii_isalnum ((char)val)) {
+                                       if ((end_ptr != NULL && *end_ptr != ';') || (val == 0 || val > 127)) {
                                                msg_info ("decode_entitles: invalid entitle code, cannot convert, strtoul returned %d, while reading %s", val, end_ptr);
                                                /* Skip undecoded */
                                                t = h;
@@ -388,13 +388,18 @@ parse_tag_url (struct worker_task *task, struct mime_text_part *part, tag_id_t i
                        c++;
                }
 
-               if (len == 0 || g_ascii_strncasecmp (c, "http://", sizeof ("http://") - 1) != 0) {
+               if (len == 0) {
                        return;
                }
                
                url_text = memory_pool_alloc (task->task_pool, len + 1);
                g_strlcpy (url_text, c, len + 1);
                decode_entitles (url_text);
+
+        if (g_ascii_strncasecmp (url_text, "http://", sizeof ("http://") - 1) != 0) {
+            return;
+        }
+
                url = memory_pool_alloc (task->task_pool, sizeof (struct uri));
                rc = parse_uri (url, url_text, task->task_pool);