[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] 9pfs: make unmarshal V9fsString more robust
From: |
Li Qiang |
Subject: |
[Qemu-devel] [PATCH] 9pfs: make unmarshal V9fsString more robust |
Date: |
Tue, 27 Sep 2016 04:44:11 -0700 |
From: Li Qiang <address@hidden>
In 9pfs function v9fs_iov_vunmarshal, it will not allocate space
for empty string. This will cause several NULL pointer dereference
issues. this patch fix this issue.
Signed-off-by: Li Qiang <address@hidden>
---
fsdev/9p-iov-marshal.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fsdev/9p-iov-marshal.c b/fsdev/9p-iov-marshal.c
index 663cad5..1d16f8d 100644
--- a/fsdev/9p-iov-marshal.c
+++ b/fsdev/9p-iov-marshal.c
@@ -125,7 +125,7 @@ ssize_t v9fs_iov_vunmarshal(struct iovec *out_sg, int
out_num, size_t offset,
str->data = g_malloc(str->size + 1);
copied = v9fs_unpack(str->data, out_sg, out_num, offset,
str->size);
- if (copied > 0) {
+ if (copied >= 0) {
str->data[str->size] = 0;
} else {
v9fs_string_free(str);
--
1.8.3.1
- [Qemu-devel] [PATCH] 9pfs: make unmarshal V9fsString more robust,
Li Qiang <=