Browse code

Fix handling of escaped characters

git-svn: trunk@2305

Nigel Horne authored on 2006/09/26 03:29:02
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Mon Sep 25 19:28:02 BST 2006 (njh)
2
+----------------------------------
3
+  * libclamav/regex_list.c:	Corrected "R" regex handler
4
+
1 5
 Sun Sep 24 21:24:07 CEST 2006 (acab)
2 6
 ------------------------------------
3 7
   * libclamav/regex_list.c: fixes for type "R" regex handler
... ...
@@ -19,6 +19,9 @@
19 19
  *  MA 02110-1301, USA.
20 20
  *
21 21
  *  $Log: regex_list.c,v $
22
+ *  Revision 1.4  2006/09/25 18:27:00  njh
23
+ *  Fix handling of escaped characters
24
+ *
22 25
  *  Revision 1.3  2006/09/24 19:28:03  acab
23 26
  *  fixes for type "R" regex handler
24 27
  *
... ...
@@ -751,14 +754,16 @@ static const unsigned char* getNextToken(const unsigned char* pat,struct token_t
751 751
 			token->u.start = ++pat;
752 752
 			if(islower(*token->u.start)) {
753 753
 				/* handle \n, \t, etc. */
754
-				char fmt[3] = {'\\',*token->u.start,'\0'};
754
+				char fmt[3] = {'\\', '\0', '\0'};
755 755
 				char c;
756
+
757
+				fmt[1] = *token->u.start;
756 758
 				if(snprintf(&c,1,fmt)!=1)
757 759
 					token->type=TOKEN_REGEX;
758 760
 				else
759 761
 					*token->u.start=c;
760 762
 			}
761
-			token->len   = 1;
763
+			token->len = 1;
762 764
 			break;
763 765
 		case '|':
764 766
 			token->type=TOKEN_ALT;