aboutsummaryrefslogtreecommitdiff
path: root/tests/qtest
diff options
context:
space:
mode:
Diffstat (limited to 'tests/qtest')
-rw-r--r--tests/qtest/virtio-9p-test.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/qtest/virtio-9p-test.c b/tests/qtest/virtio-9p-test.c
index e7b58e3..06263ed 100644
--- a/tests/qtest/virtio-9p-test.c
+++ b/tests/qtest/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);
}