Browse code

better script end detection

git-svn: trunk@3679

Török Edvin authored on 2008/02/27 07:20:13
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Tue Feb 26 23:21:59 EET 2008 (edwin)
2
+------------------------------------
3
+  * libclamav/htmlnorm.c: better script end detection
4
+
1 5
 Tue Feb 26 22:36:38 EET 2008 (edwin)
2 6
 ------------------------------------
3 7
   * libclamav/htmlnorm.c: change ' to " inside scripts
... ...
@@ -713,6 +713,10 @@ static int cli_html_normalise(int fd, m_area_t *m_area, const char *dirname, tag
713 713
 					next_state = HTML_PROCESS_TAG;
714 714
 				} else if (!isspace(*ptr)) {
715 715
 					html_output_c(file_buff_o2, tolower(*ptr));
716
+					/* if we're inside a script we only care for </script>.*/
717
+					if(in_script && tag_length==0 && *ptr != '/') {
718
+						state = HTML_NORM;
719
+					}
716 720
 					if (tag_length < HTML_STR_LENGTH) {
717 721
 						tag[tag_length++] = tolower(*ptr);
718 722
 					}
... ...
@@ -721,8 +725,7 @@ static int cli_html_normalise(int fd, m_area_t *m_area, const char *dirname, tag
721 721
 					tag[tag_length] = '\0';
722 722
 					state = HTML_SKIP_WS;
723 723
 					tag_arg_length = 0;
724
-					/* if we're inside a script we only care for </script>.
725
-					 * if we'd go to HTML_TAG_ARG whitespace would be inconsistently normalized*/
724
+					/* if we'd go to HTML_TAG_ARG whitespace would be inconsistently normalized for in_script*/
726 725
 					next_state = !in_script ? HTML_TAG_ARG : HTML_NORM;
727 726
 				}
728 727
 				break;