All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix iptables-restore escaping of quotes
@ 2004-12-20  6:31 Philip Craig
  0 siblings, 0 replies; only message in thread
From: Philip Craig @ 2004-12-20  6:31 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: Type: text/plain, Size: 379 bytes --]

iptables-restore was losing a character at the start of the parameter
for every escaped quote within the parameter.

This is of signifance when there are " characters in log prefixes.
Note that iptables-save can't generate escaped quotes;  I am
generating the input for iptables-restore from a script.

-- 
Philip Craig - SnapGear, A CyberGuard Company - http://www.SnapGear.com

[-- Attachment #2: iptables-escape-quote.patch --]
[-- Type: text/plain, Size: 759 bytes --]

Index: iptables-restore.c
===================================================================
--- iptables-restore.c	(revision 3377)
+++ iptables-restore.c	(working copy)
@@ -336,12 +336,15 @@
 			param_start = parsestart;
 			
 			for (curchar = parsestart; *curchar; curchar++) {
+				if (*curchar == '\\' && *(curchar+1) == '"') {
+					if (quote_open) {
+						memmove(curchar, curchar+1,
+							strlen(curchar+1));
+						continue;
+					}
+				}
 				if (*curchar == '"') {
-					/* quote_open cannot be true if there
-					 * was no previous character.  Thus, 
-					 * curchar-1 has to be within bounds */
-					if (quote_open && 
-					    *(curchar-1) != '\\') {
+					if (quote_open) {
 						quote_open = 0;
 						*curchar = ' ';
 					} else {

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-12-20  6:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-20  6:31 [PATCH] fix iptables-restore escaping of quotes Philip Craig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.