Skip to contentSkip to conversation

hw/9pfs: Initialize rest of qid field to zero.

PATCH New Aneesh Kumar K.V 1 participant 1 message Aug 25, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/9pfs: Initialize rest of qid field to zero.

Since qid is allocated out of stack we need to intialize the field to zero. Otherwise we will send wrong qid value to client.

---
 hw/9pfs/virtio-9p.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
hw/9pfs/virtio-9p.c +1 -0
index 6b275a5..e70d8f6 100644
@@ -543,6 +543,7 @@ static void stat_to_qid(const struct stat *stbuf, V9fsQID *qidp)
 {
     size_t size;
 
+    memset(&qidp->path, 0, sizeof(qidp->path));
     size = MIN(sizeof(stbuf->st_ino), sizeof(qidp->path));
     memcpy(&qidp->path, &stbuf->st_ino, size);
     qidp->version = stbuf->st_mtime ^ (stbuf->st_size << 8);
Signature · 1 line
1.7.4.1