From: John Snow <jsnow@redhat.com>
To: qemu-devel@nongnu.org
Cc: marc.mari.barcelo@gmail.com, pbonzini@redhat.com,
John Snow <jsnow@redhat.com>,
afaerber@suse.de, stefanha@redhat.com
Subject: [Qemu-devel] [RFC 1/3] qtest: allow arbitrarily long sends
Date: Wed, 25 Feb 2015 11:34:56 -0500 [thread overview]
Message-ID: <1424882098-10674-2-git-send-email-jsnow@redhat.com> (raw)
In-Reply-To: <1424882098-10674-1-git-send-email-jsnow@redhat.com>
qtest currently has a static buffer of size 1024 that if we
overflow, ignores the additional data silently which leads
to hangs or stream failures.
Use glib's string facilities to allow arbitrarily long data.
Signed-off-by: John Snow <jsnow@redhat.com>
---
qtest.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/qtest.c b/qtest.c
index 2bca04e..242dcc0 100644
--- a/qtest.c
+++ b/qtest.c
@@ -186,11 +186,12 @@ static void GCC_FMT_ATTR(2, 3) qtest_send(CharDriverState *chr,
const char *fmt, ...)
{
va_list ap;
- char buffer[1024];
size_t len;
+ gchar *buffer;
va_start(ap, fmt);
- len = vsnprintf(buffer, sizeof(buffer), fmt, ap);
+ buffer = g_strdup_vprintf(fmt, ap);
+ len = strlen(buffer);
va_end(ap);
qemu_chr_fe_write_all(chr, (uint8_t *)buffer, len);
--
1.9.3
next prev parent reply other threads:[~2015-02-25 17:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-25 16:34 [Qemu-devel] [RFC 0/3] qtest: base64 r/w and faster memset John Snow
2015-02-25 16:34 ` John Snow [this message]
2015-02-25 16:34 ` [Qemu-devel] [RFC 2/3] qtest: Add base64 encoded read/write John Snow
2015-02-25 16:34 ` [Qemu-devel] [RFC 3/3] qtest: add memset to qtest protocol John Snow
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=1424882098-10674-2-git-send-email-jsnow@redhat.com \
--to=jsnow@redhat.com \
--cc=afaerber@suse.de \
--cc=marc.mari.barcelo@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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).