From: Markus Armbruster <armbru@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 3/4] qtest: Avoid passing raw strings through hmp()
Date: Fri, 21 Jul 2017 15:50:55 +0200 [thread overview]
Message-ID: <87shhpj3uo.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <20170720214008.28494-4-eblake@redhat.com> (Eric Blake's message of "Thu, 20 Jul 2017 16:40:07 -0500")
Eric Blake <eblake@redhat.com> writes:
> The next patch will add __attribute__((__format__)) to hmp(), which
It did in v1, but no more. Intentional?
> in turn causes gcc to warn about non-literal format strings. Rather
> than risk an arbitrary string containing % being mis-handled, always
> pass variable strings along with a %s format. It also makes it
> easier to prove correctness locally, rather than auditing all the
> source strings.
>
> Signed-off-by: Eric Blake <eblake@redhat.com>
> Reviewed-by: Markus Armbruster <armbru@redhat.com>
> ---
> tests/test-hmp.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tests/test-hmp.c b/tests/test-hmp.c
> index d77b3c8710..0af066487c 100644
> --- a/tests/test-hmp.c
> +++ b/tests/test-hmp.c
> @@ -80,7 +80,7 @@ static void test_commands(void)
> if (verbose) {
> fprintf(stderr, "\t%s\n", hmp_cmds[i]);
> }
> - response = hmp(hmp_cmds[i]);
> + response = hmp("%s", hmp_cmds[i]);
> g_free(response);
> }
>
> @@ -103,7 +103,7 @@ static void test_info_commands(void)
> if (verbose) {
> fprintf(stderr, "\t%s\n", info);
> }
> - resp = hmp(info);
> + resp = hmp("%s", info);
> g_free(resp);
> /* And move forward to the next line */
> info = strchr(endp + 1, '\n');
next prev parent reply other threads:[~2017-07-21 13:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-20 21:40 [Qemu-devel] [PATCH for-2.10? v2 0/4] random qapi cleanups Eric Blake
2017-07-20 21:40 ` [Qemu-devel] [PATCH v2 1/4] tests: Enhance qobject output to cover partial visit Eric Blake
2017-07-20 21:40 ` [Qemu-devel] [PATCH v2 2/4] qapi: Visitor documentation tweak Eric Blake
2017-07-20 21:40 ` [Qemu-devel] [PATCH v2 3/4] qtest: Avoid passing raw strings through hmp() Eric Blake
2017-07-21 13:50 ` Markus Armbruster [this message]
2017-07-21 14:04 ` Eric Blake
2017-07-21 14:32 ` Markus Armbruster
2017-07-20 21:40 ` [Qemu-devel] [PATCH v2 4/4] qtest: Document calling conventions Eric Blake
2017-07-20 22:08 ` [Qemu-devel] [PATCH for-2.10? v2 0/4] random qapi cleanups no-reply
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=87shhpj3uo.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=qemu-devel@nongnu.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 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.