Re: [Qemu-devel] [PATCH] fsdev/virtfs-proxy-helper: Fix possible overflow

2015-03-13 Thread Paolo Bonzini
On 13/03/2015 12:09, Shannon Zhao wrote: > +g_assert(strlen(path) < sizeof(proxy.sun_path)); > sock = socket(AF_UNIX, SOCK_STREAM, 0); > if (sock < 0) { > do_perror("socket"); > @@ -748,7 +749,7 @@ static int proxy_socket(const char *path, uid_t uid, > gid_t gid) > um

[Qemu-devel] [PATCH] fsdev/virtfs-proxy-helper: Fix possible overflow

2015-03-13 Thread Shannon Zhao
It's detected by coverity. As max of sockaddr_un.sun_path is sizeof(helper.sun_path), should check the length of source and use strncpy instead of strcpy. Signed-off-by: Shannon Zhao Signed-off-by: Shannon Zhao --- fsdev/virtfs-proxy-helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion