qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC 1/3] qtest: allow arbitrarily long sends


From: John Snow
Subject: [Qemu-devel] [RFC 1/3] qtest: allow arbitrarily long sends
Date: Wed, 25 Feb 2015 11:34:56 -0500

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 <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]