From: Patrick McHardy <kaber@trash.net>
To: Max Kellermann <max@duempel.org>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] xtables: use strspn() to check if string needs to be quoted
Date: Thu, 17 Feb 2011 12:00:40 +0100 [thread overview]
Message-ID: <4D5CFFD8.8000804@trash.net> (raw)
In-Reply-To: <20110214065445.30608.81511.stgit@woodpecker.blarg.de>
Am 14.02.2011 07:54, schrieb Max Kellermann:
> 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().
Looks good to me, applied. But please remember to sign off your
patches.
prev parent reply other threads:[~2011-02-17 11:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-14 6:54 [PATCH] xtables: use strspn() to check if string needs to be quoted Max Kellermann
2011-02-17 11:00 ` Patrick McHardy [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D5CFFD8.8000804@trash.net \
--to=kaber@trash.net \
--cc=max@duempel.org \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).