Browse code

better handling for \n

git-svn: trunk@3330

Török Edvin authored on 2007/10/30 04:19:20
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Mon Oct 29 20:27:36 EET 2007 (edwin)
2
+------------------------------------
3
+  * libclamav/phishcheck.c: better handling for \n
4
+
1 5
 Fri Oct 26 19:58:02 CEST 2007 (tk)
2 6
 ----------------------------------
3 7
   * add COPYING.unrar; TODO: add GPL exception for libclamunrar
... ...
@@ -735,9 +735,15 @@ cleanupURL(struct string *URL,struct string *pre_URL, int isReal)
735 735
 		str_make_lowercase(host_begin,host_len);
736 736
 		/* convert %xx to real value */
737 737
 		str_hex_to_char(&begin,&end);
738
-		/* trim space */
739
-		while((begin <= end) && (begin[0]==' '))  begin++;
740
-		while((begin <= end) && (end[0]==' ')) end--;
738
+		if(isReal) {
739
+			/* htmlnorm converts \n to space, so we have to strip spaces */
740
+			str_strip(&begin, &end, " ", 1);
741
+		}
742
+		else {
743
+			/* trim space */
744
+			while((begin <= end) && (begin[0]==' '))  begin++;
745
+			while((begin <= end) && (end[0]==' ')) end--;
746
+		}
741 747
 		if (( rc = string_assign_dup(isReal ? URL : pre_URL,begin,end+1) )) {
742 748
 			string_assign_null(URL);
743 749
 			return rc;