]> Git Repo - qemu.git/blobdiff - hw/9pfs/virtio-9p-xattr.c
virtio-9p-device: Avoid freeing uninitialized memory
[qemu.git] / hw / 9pfs / virtio-9p-xattr.c
index 7f08f6e1763d11bef4dc7ca7aa365331b0f4ad94..90ae565c1914b897b651faf6358f507ebccab154 100644 (file)
@@ -11,7 +11,7 @@
  *
  */
 
-#include "hw/virtio.h"
+#include "hw/virtio/virtio.h"
 #include "virtio-9p.h"
 #include "fsdev/file-op-9p.h"
 #include "virtio-9p-xattr.h"
@@ -53,7 +53,8 @@ ssize_t pt_listxattr(FsContext *ctx, const char *path,
         return -1;
     }
 
-    strncpy(value, name, name_size);
+    /* no need for strncpy: name_size is strlen(name)+1 */
+    memcpy(value, name, name_size);
     return name_size;
 }
 
This page took 0.026183 seconds and 4 git commands to generate.