fix iptables-restore escaping of quotes
PATCH 1/1 fix iptables-restore escaping of quotes
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.
Signature · 1 line
Philip Craig - SnapGear, A CyberGuard Company - http://www.SnapGear.com
iptables-restore.c +8 -5
@@ -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 {