From: Kevin Wolf <kwolf@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, hutao@cn.fujitsu.com, qemu-trivial@nongnu.org,
mst@redhat.com
Subject: [Qemu-devel] [PATCH for-2.1] test-string-output-visitor: Fix unterminated string
Date: Wed, 9 Jul 2014 16:14:48 +0200 [thread overview]
Message-ID: <1404915288-604-1-git-send-email-kwolf@redhat.com> (raw)
Don't forget to add a terminating '\0' or the test case will be randomly
failing. The broken code was added in commit b4900c0e.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
tests/test-string-output-visitor.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/test-string-output-visitor.c b/tests/test-string-output-visitor.c
index e89e43c..f2c427f 100644
--- a/tests/test-string-output-visitor.c
+++ b/tests/test-string-output-visitor.c
@@ -201,11 +201,11 @@ static void test_visitor_out_enum(TestOutputVisitorData *data,
visit_type_EnumOne(data->ov, &i, "unused", &err);
g_assert(!err);
- len = strlen(EnumOne_lookup[i]) + 2;
+ len = strlen(EnumOne_lookup[i]) + 3;
str_human = g_malloc0(len);
str_human[0] = '"';
strncpy(str_human + 1, EnumOne_lookup[i], strlen(EnumOne_lookup[i]));
- str_human[len - 1] = '"';
+ str_human[len - 2] = '"';
str = string_output_get_string(data->sov);
g_assert(str != NULL);
--
1.8.3.1
next reply other threads:[~2014-07-09 14:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-09 14:14 Kevin Wolf [this message]
2014-07-10 1:41 ` [Qemu-devel] [PATCH for-2.1] test-string-output-visitor: Fix unterminated string Eric Blake
2014-07-10 8:00 ` Kevin Wolf
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=1404915288-604-1-git-send-email-kwolf@redhat.com \
--to=kwolf@redhat.com \
--cc=hutao@cn.fujitsu.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@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).