summaryrefslogtreecommitdiff
path: root/hw/9pfs/virtio-9p-posix-acl.c
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2012-10-04 13:09:56 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2012-10-05 07:58:37 -0500
commit9238c2099d37748a4e2cbbe709ed1ebffa6f3c8b (patch)
treea2a3b8b714380d4c8e6013b795c0a70f157fc48a /hw/9pfs/virtio-9p-posix-acl.c
parente5fda03839e3c61b01d6c60de5625501d01c69d0 (diff)
downloadqemu-9238c2099d37748a4e2cbbe709ed1ebffa6f3c8b.tar.gz
virtio-9p: avoid unwarranted uses of strncpy
In all of these cases, the uses of strncpy were unnecessary, since at each point of use we know that the NUL-terminated source bytes fit in the destination buffer. Use memcpy in place of strncpy. Acked-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Jim Meyering <meyering@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/9pfs/virtio-9p-posix-acl.c')
-rw-r--r--hw/9pfs/virtio-9p-posix-acl.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/hw/9pfs/virtio-9p-posix-acl.c b/hw/9pfs/virtio-9p-posix-acl.c
index a1948e3aff..c064017b1f 100644
--- a/hw/9pfs/virtio-9p-posix-acl.c
+++ b/hw/9pfs/virtio-9p-posix-acl.c
@@ -44,7 +44,8 @@ static ssize_t mp_pacl_listxattr(FsContext *ctx, const char *path,
return -1;
}
- strncpy(value, ACL_ACCESS, len);
+ /* len includes the trailing NUL */
+ memcpy(value, ACL_ACCESS, len);
return 0;
}
@@ -95,7 +96,8 @@ static ssize_t mp_dacl_listxattr(FsContext *ctx, const char *path,
return -1;
}
- strncpy(value, ACL_DEFAULT, len);
+ /* len includes the trailing NUL */
+ memcpy(value, ACL_ACCESS, len);
return 0;
}