libxt_string: escape the escaping char too
References: http://bugzilla.netfilter.org/show_bug.cgi?id=740
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
diff --git a/extensions/libxt_string.c b/extensions/libxt_string.c
index 472035f..fb15980 100644
--- a/extensions/libxt_string.c
+++ b/extensions/libxt_string.c
@@ -242,7 +242,7 @@
unsigned int i;
printf(" \"");
for (i=0; i < len; i++) {
- if (str[i] == '\"') /* escape any embedded quotes */
+ if (str[i] == '\"' || str[i] == '\\')
putchar('\\');
printf("%c", (unsigned char) str[i]);
}
diff --git a/tests/options-most.rules b/tests/options-most.rules
index e54eb12..ae28b82 100644
--- a/tests/options-most.rules
+++ b/tests/options-most.rules
@@ -128,6 +128,10 @@
-A matches
-A matches -m statistic --mode nth ! --every 5 --packet 2
-A matches
+-A matches -m string --hex-string "action=|5C22|http|3A|" --algo bm
+-A matches
+-A matches -m string --hex-string "action=|5C|http|3A|" --algo bm
+-A matches
-A matches -m time --timestart 01:02:03 --timestop 04:05:06 --monthdays 1,2,3,4,5 --weekdays Mon,Fri,Sun --datestart 2001-02-03T04:05:06 --datestop 2012-09-08T09:06:05 --localtz
-A matches
-A matches -m time --timestart 01:02:03 --timestop 04:05:06 --monthdays 1,2,3,4,5 --weekdays Mon,Fri,Sun --datestart 2001-02-03T04:05:06 --datestop 2012-09-08T09:06:05 --kerneltz