qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/9] tests/virtio-9p: v9fs_string_read() didn't terminate string
@ 2019-12-15 23:17 Christian Schoenebeck
  2019-12-18  8:47 ` Greg Kurz
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Schoenebeck @ 2019-12-15 23:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: Greg Kurz

Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
---
 tests/virtio-9p-test.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/virtio-9p-test.c b/tests/virtio-9p-test.c
index e7b58e3a0c..880b4ff567 100644
--- a/tests/virtio-9p-test.c
+++ b/tests/virtio-9p-test.c
@@ -130,8 +130,9 @@ static void v9fs_string_read(P9Req *req, uint16_t *len, char **string)
         *len = local_len;
     }
     if (string) {
-        *string = g_malloc(local_len);
+        *string = g_malloc(local_len+1);
         v9fs_memread(req, *string, local_len);
+        (*string)[local_len] = 0;
     } else {
         v9fs_memskip(req, local_len);
     }
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-18  8:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-15 23:17 [PATCH 1/9] tests/virtio-9p: v9fs_string_read() didn't terminate string Christian Schoenebeck
2019-12-18  8:47 ` Greg Kurz

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).