git-svn: trunk@2905
Török Edvin authored on 2007/03/06 04:31:17... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Fri Mar 2 19:36:00 CEST 2007 (edwin) |
|
2 |
+------------------------------------- |
|
3 |
+ * libclamav/htmlnorm.c: ampersands were missed in URLs. (bb #377) |
|
4 |
+ |
|
1 | 5 |
Mon Mar 5 17:09:00 GMT 2007 (njh) |
2 | 6 |
---------------------------------- |
3 | 7 |
* libclamav/mbox.c: Fix debug message (bug 378) |
... | ... |
@@ -1131,6 +1131,9 @@ static int cli_html_normalise(int fd, m_area_t *m_area, const char *dirname, tag |
1131 | 1131 |
#ifdef CL_EXPERIMENTAL |
1132 | 1132 |
state = HTML_ENTITY_REF_DECODE; |
1133 | 1133 |
#else |
1134 |
+ if(next_state == HTML_TAG_ARG_VAL && tag_val_length < HTML_STR_LENGTH) { |
|
1135 |
+ tag_val[tag_val_length++] = '&'; |
|
1136 |
+ } |
|
1134 | 1137 |
html_output_c(file_buff_o1, file_buff_o2, '&'); |
1135 | 1138 |
|
1136 | 1139 |
state = next_state; |
... | ... |
@@ -1149,7 +1152,7 @@ static int cli_html_normalise(int fd, m_area_t *m_area, const char *dirname, tag |
1149 | 1149 |
for(i=0; i < strlen(normalized); i++) { |
1150 | 1150 |
const char c = tolower(normalized[i]); |
1151 | 1151 |
html_output_c(file_buff_o1, file_buff_o2, c); |
1152 |
- if (tag_val_length < HTML_STR_LENGTH) { |
|
1152 |
+ if (next_state == HTML_TAG_ARG_VAL && tag_val_length < HTML_STR_LENGTH) { |
|
1153 | 1153 |
tag_val[tag_val_length++] = c; |
1154 | 1154 |
} |
1155 | 1155 |
} |
... | ... |
@@ -1157,13 +1160,19 @@ static int cli_html_normalise(int fd, m_area_t *m_area, const char *dirname, tag |
1157 | 1157 |
} |
1158 | 1158 |
else { |
1159 | 1159 |
html_output_c(file_buff_o1, file_buff_o2, '&'); |
1160 |
+ if (next_state == HTML_TAG_ARG_VAL && tag_val_length < HTML_STR_LENGTH) { |
|
1161 |
+ tag_val[tag_val_length++] = '&'; |
|
1162 |
+ } |
|
1160 | 1163 |
for(i=0; i < entity_val_length; i++) { |
1161 | 1164 |
const char c = tolower(entity_val[i]); |
1162 | 1165 |
html_output_c(file_buff_o1, file_buff_o2, c); |
1163 |
- if (tag_val_length < HTML_STR_LENGTH) { |
|
1166 |
+ if (next_state == HTML_TAG_ARG_VAL && tag_val_length < HTML_STR_LENGTH) { |
|
1164 | 1167 |
tag_val[tag_val_length++] = c; |
1165 | 1168 |
} |
1166 | 1169 |
} |
1170 |
+ if (next_state == HTML_TAG_ARG_VAL && tag_val_length < HTML_STR_LENGTH) { |
|
1171 |
+ tag_val[tag_val_length++] = ';'; |
|
1172 |
+ } |
|
1167 | 1173 |
html_output_c(file_buff_o1, file_buff_o2, ';'); |
1168 | 1174 |
} |
1169 | 1175 |
entity_val_length = 0; |
... | ... |
@@ -1177,11 +1186,14 @@ static int cli_html_normalise(int fd, m_area_t *m_area, const char *dirname, tag |
1177 | 1177 |
else { |
1178 | 1178 |
/* entity too long, or not valid, dump it */ |
1179 | 1179 |
size_t i; |
1180 |
+ if (next_state==HTML_TAG_ARG_VAL && tag_val_length < HTML_STR_LENGTH) { |
|
1181 |
+ tag_val[tag_val_length++] = '&'; |
|
1182 |
+ } |
|
1180 | 1183 |
html_output_c(file_buff_o1, file_buff_o2, '&'); |
1181 | 1184 |
for(i=0; i < entity_val_length; i++) { |
1182 | 1185 |
const char c = tolower(entity_val[i]); |
1183 | 1186 |
html_output_c(file_buff_o1, file_buff_o2, c); |
1184 |
- if (tag_val_length < HTML_STR_LENGTH) { |
|
1187 |
+ if (next_state==HTML_TAG_ARG_VAL && tag_val_length < HTML_STR_LENGTH) { |
|
1185 | 1188 |
tag_val[tag_val_length++] = c; |
1186 | 1189 |
} |
1187 | 1190 |
} |
... | ... |
@@ -1198,8 +1210,8 @@ static int cli_html_normalise(int fd, m_area_t *m_area, const char *dirname, tag |
1198 | 1198 |
ptr++; |
1199 | 1199 |
} else if (*ptr == ';') { |
1200 | 1200 |
#ifdef CL_EXPERIMENTAL |
1201 |
- if (tag_val_length < HTML_STR_LENGTH) { |
|
1202 |
- tag_val[tag_val_length++] = value; /* store encoded values too */ |
|
1201 |
+ if (next_state==HTML_TAG_ARG_VAL && tag_val_length < HTML_STR_LENGTH) { |
|
1202 |
+ tag_val[tag_val_length++] = value; /* store encoded values too */ |
|
1203 | 1203 |
} |
1204 | 1204 |
|
1205 | 1205 |
if((value < 0x80 && value >= 0x20) || (value >= 0 && value <= 0xff && isspace(value))) |