]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
allow embedding of quote character inside quoted string (Michael Rash)
authorMichael Rash <mbr@cipherdyne.org>
Mon, 5 Jan 2004 09:41:50 +0000 (09:41 +0000)
committerHarald Welte <laforge@gnumonks.org>
Mon, 5 Jan 2004 09:41:50 +0000 (09:41 +0000)
ip6tables-restore.c
iptables-restore.c

index ecda87028f0a7e1729b4d83de1e596484c9abf40..cc60e234a2c7100923f24e4a0e4f10ae74b60605 100644 (file)
@@ -7,7 +7,7 @@
  *     Rusty Russell <rusty@linuxcare.com.au>
  * This code is distributed under the terms of GNU GPL v2
  *
- * $Id: ip6tables-restore.c,v 1.11 2003/03/05 07:46:15 laforge Exp $
+ * $Id: ip6tables-restore.c,v 1.12 2003/05/02 15:30:11 laforge Exp $
  */
 
 #include <getopt.h>
@@ -321,7 +321,11 @@ int main(int argc, char *argv[])
                        
                        for (curchar = parsestart; *curchar; curchar++) {
                                if (*curchar == '"') {
-                                       if (quote_open) {
+                                       /* quote_open cannot be true if there
+                                        * was no previous character.  Thus, 
+                                        * curchar-1 has to be within bounds */
+                                       if (quote_open && 
+                                           *(curchar-1) != '\\') {
                                                quote_open = 0;
                                                *curchar = ' ';
                                        } else {
index c1888ce5e9d41774dff2ed89b93060384fd4dc5e..0a5627dadec92e4a75104e69080444fe3f2ba961 100644 (file)
@@ -4,7 +4,7 @@
  *
  * This code is distributed under the terms of GNU GPL v2
  *
- * $Id: iptables-restore.c,v 1.25 2003/03/06 11:56:31 laforge Exp $
+ * $Id: iptables-restore.c,v 1.26 2003/05/02 15:30:11 laforge Exp $
  */
 
 #include <getopt.h>
@@ -318,7 +318,11 @@ int main(int argc, char *argv[])
                        
                        for (curchar = parsestart; *curchar; curchar++) {
                                if (*curchar == '"') {
-                                       if (quote_open) {
+                                       /* quote_open cannot be true if there
+                                        * was no previous character.  Thus, 
+                                        * curchar-1 has to be within bounds */
+                                       if (quote_open && 
+                                           *(curchar-1) != '\\') {
                                                quote_open = 0;
                                                *curchar = ' ';
                                        } else {