Browse code

avoid some false positives when there are spaces in URL.

git-svn: trunk@3263

Török Edvin authored on 2007/10/03 21:53:09
Showing 3 changed files
... ...
@@ -1,3 +1,8 @@
1
+Wed Oct  3 15:10:28 EEST 2007 (edwin)
2
+------------------------------------
3
+  * libclamav/regex_list.[ch]: avoid some false positives when there are
4
+  spaces in URL. 
5
+ 
1 6
 Wed Oct  3 01:48:26 CEST 2007 (tk)
2 7
 ----------------------------------
3 8
   * libclamav/matcher-ac.[ch]: - add basic support for string alternatives
... ...
@@ -253,7 +253,7 @@ static inline size_t get_char_at_pos_with_skip(const struct pre_fixup_info* info
253 253
  * Do not send NULL pointers to this function!!
254 254
  *
255 255
  */
256
-int regex_list_match(struct regex_matcher* matcher,const char* real_url,const char* display_url,const struct pre_fixup_info* pre_fixup,int hostOnly,const char** info,int is_whitelist)
256
+int regex_list_match(struct regex_matcher* matcher,char* real_url,const char* display_url,const struct pre_fixup_info* pre_fixup,int hostOnly,const char** info,int is_whitelist)
257 257
 {
258 258
 	massert(matcher);
259 259
 	massert(real_url);
... ...
@@ -304,6 +304,11 @@ int regex_list_match(struct regex_matcher* matcher,const char* real_url,const ch
304 304
 						/* subdomain matched*/)) {
305 305
 
306 306
 						cli_dbgmsg("Got a match: %s with %s\n",buffer,*info);
307
+						cli_dbgmsg("Before inserting .: %s\n",real_url);
308
+						if(real_len >= match_len + 1) {
309
+							real_url[real_len-match_len-1]='.';
310
+							cli_dbgmsg("After inserting .: %s\n",real_url);
311
+						}
307 312
 						break;
308 313
 					}
309 314
 					cli_dbgmsg("Ignoring false match: %s with %s,%c\n",buffer,*info,c);
... ...
@@ -52,7 +52,7 @@ struct regex_matcher {
52 52
 	struct node_stack node_stack_alt;
53 53
 };
54 54
 
55
-int regex_list_match(struct regex_matcher* matcher,const char* real_url,const char* display_url,const struct pre_fixup_info* pre_fixup, int hostOnly,const char** info,int is_whitelist);
55
+int regex_list_match(struct regex_matcher* matcher, char* real_url,const char* display_url,const struct pre_fixup_info* pre_fixup, int hostOnly,const char** info,int is_whitelist);
56 56
 int init_regex_list(struct regex_matcher* matcher);
57 57
 int load_regex_matcher(struct regex_matcher* matcher,FILE* fd,unsigned int options,int is_whitelist);
58 58
 void regex_list_cleanup(struct regex_matcher* matcher);