Browse code

SVN r3619 broke phishing detection, fixed it

git-svn: trunk@3625

Török Edvin authored on 2008/02/13 19:24:51
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Wed Feb 13 12:11:08 EET 2008 (edwin)
2
+------------------------------------
3
+  * libclamav/htmlnorm.c: SVN r3619 broke phishing detection, fixed it
4
+
1 5
 Wed Feb 13 02:49:38 CET 2008 (acab)
2 6
 -----------------------------------
3 7
   * limits: Set new defaults, updated sample config files
... ...
@@ -546,7 +546,6 @@ static int cli_html_normalise(int fd, m_area_t *m_area, const char *dirname, tag
546 546
 	tag_args.tag = NULL;
547 547
 	tag_args.value = NULL;
548 548
 	tag_args.contents = NULL;
549
-
550 549
 	if (dirname) {
551 550
 		snprintf(filename, 1024, "%s/rfc2397", dirname);
552 551
 		if (mkdir(filename, 0700) && errno != EEXIST) {
... ...
@@ -1015,18 +1014,6 @@ static int cli_html_normalise(int fd, m_area_t *m_area, const char *dirname, tag
1015 1015
 						in_script = TRUE;
1016 1016
 					}
1017 1017
 					html_output_tag(file_buff_script, tag, &tag_args);
1018
-				} else if (strcmp(tag, "a") == 0) {
1019
-					arg_value = html_tag_arg_value(&tag_args, "href");
1020
-					if(arg_value && arg_value[0]) {
1021
-						html_output_str(file_buff_text, arg_value, strlen(arg_value));
1022
-						html_output_c(file_buff_text, NULL, ' ');
1023
-					}
1024
-				} else if (strcmp(tag, "img") == 0) {
1025
-					arg_value = html_tag_arg_value(&tag_args, "src");
1026
-					if(arg_value && arg_value[0]) {
1027
-						html_output_str(file_buff_text, arg_value, strlen(arg_value));
1028
-						html_output_c(file_buff_text, NULL, ' ');
1029
-					}
1030 1018
 				} else if (hrefs) {
1031 1019
 					if(in_ahref && !href_contents_begin)
1032 1020
 						href_contents_begin=ptr;
... ...
@@ -1141,6 +1128,19 @@ static int cli_html_normalise(int fd, m_area_t *m_area, const char *dirname, tag
1141 1141
 						}
1142 1142
 					}
1143 1143
 					/* TODO:imagemaps can have urls too */
1144
+				} else if (strcmp(tag, "a") == 0) {
1145
+					/* a/img tags for buff_text can be processed only if we're not processing hrefs */
1146
+					arg_value = html_tag_arg_value(&tag_args, "href");
1147
+					if(arg_value && arg_value[0]) {
1148
+						html_output_str(file_buff_text, arg_value, strlen(arg_value));
1149
+						html_output_c(file_buff_text, NULL, ' ');
1150
+					}
1151
+				} else if (strcmp(tag, "img") == 0) {
1152
+					arg_value = html_tag_arg_value(&tag_args, "src");
1153
+					if(arg_value && arg_value[0]) {
1154
+						html_output_str(file_buff_text, arg_value, strlen(arg_value));
1155
+						html_output_c(file_buff_text, NULL, ' ');
1156
+					}
1144 1157
 				}
1145 1158
 				html_tag_arg_free(&tag_args);
1146 1159
 				break;