From: Eric Blake <eblake@redhat.com>
To: "Andreas Färber" <afaerber@suse.de>, qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Hu Tao <hutao@cn.fujitsu.com>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH buildfix for-2.1] tests: Fix unterminated string output visitor enum human string
Date: Wed, 09 Jul 2014 14:40:26 -0600 [thread overview]
Message-ID: <53BDA8BA.4090504@redhat.com> (raw)
In-Reply-To: <1404937729-19780-1-git-send-email-afaerber@suse.de>
[-- Attachment #1: Type: text/plain, Size: 1111 bytes --]
On 07/09/2014 02:28 PM, Andreas Färber wrote:
> The buffer was being allocated of size string length plus two.
> Around the string two quotes were being added, but no terminating NUL.
> It was then compared using g_assert_cmpstr(), resulting in fairly random
> assertion failures:
>
> ERROR:tests/test-string-output-visitor.c:213:test_visitor_out_enum: assertion failed (str == str_human): ("\"value1\"" == "\"value1\"\001EEEEEEEEEEEEEE\0171")
>
> There is no g_assert_cmpnstr() counterpart, so use g_strdup_printf()
> for safely assembling the string in the first place.
>
> Cc: Hu Tao <hutao@cn.fujitsu.com>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Suggested-by: Eric Blake <eblake@redhat.com>
> Fixes: b4900c0 tests: add human format test for string output visitor
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> ---
> tests/test-string-output-visitor.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2014-07-09 20:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-09 20:28 [Qemu-devel] [PATCH buildfix for-2.1] tests: Fix unterminated string output visitor enum human string Andreas Färber
2014-07-09 20:40 ` Eric Blake [this message]
2014-07-10 7:33 ` Hu Tao
2014-07-10 13:29 ` Peter Maydell
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=53BDA8BA.4090504@redhat.com \
--to=eblake@redhat.com \
--cc=afaerber@suse.de \
--cc=hutao@cn.fujitsu.com \
--cc=mst@redhat.com \
--cc=peter.maydell@linaro.org \
--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 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).