diff options
author | Max Kellerman <max@duempel.org> | 2011-02-17 11:57:19 +0100 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2011-02-17 11:57:19 +0100 |
commit | 87dc7c4c842deb1e2e3d38089ffcad9f238d98de (patch) | |
tree | 6fe554ce58d037ebe7ac6245e5012b434044203a /extensions/libip6t_dst.c | |
parent | e1df221d7a1b3df0224d94865ec05ba336995608 (diff) |
xtables: use strspn() to check if string needs to be quoted
Problem: the call xtables_save_string("'") prints just a single quote,
not enclosed in double quoted and not escaped.
Steps to reproduce:
$ iptables -A foo -m comment --comment "'" -j ACCEPT
$ iptables-multi save|grep foo
-A foo -m comment --comment ' -j ACCEPT
The cause was the use of strcspn() to locate the first character which
justified quoting the string in double quotes. That however was
wrong, because the way strcspn() was called, it returned a pointer to
the first character that was not to be escaped, which did the right
thing most of the time, but not for strings consisting only of quote
characters. This patch changes strcspn() to strspn().
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'extensions/libip6t_dst.c')
0 files changed, 0 insertions, 0 deletions