Re: [Qemu-devel] [PATCH] hw/9pfs/virtio-9p-proxy: Fix possible overflow

2015-03-16 Thread Shannon Zhao
On 2015/3/16 15:58, Aneesh Kumar K.V wrote: > Shannon Zhao writes: > >> 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 Zha

Re: [Qemu-devel] [PATCH] hw/9pfs/virtio-9p-proxy: Fix possible overflow

2015-03-16 Thread Aneesh Kumar K.V
Shannon Zhao writes: > 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 > --- > hw/9pfs/virtio-9p-proxy.c | 3 ++- > 1 fil

Re: [Qemu-devel] [PATCH] hw/9pfs/virtio-9p-proxy: Fix possible overflow

2015-03-13 Thread Shannon Zhao
On 2015/3/13 20:50, Paolo Bonzini wrote: > > > On 13/03/2015 12:09, Shannon Zhao wrote: >> +g_assert(strlen(path) < sizeof(helper.sun_path)); > > Ok. > >> sockfd = socket(AF_UNIX, SOCK_STREAM, 0); >> if (sockfd < 0) { >> fprintf(stderr, "failed to create socket: %s\n", st

Re: [Qemu-devel] [PATCH] hw/9pfs/virtio-9p-proxy: Fix possible overflow

2015-03-13 Thread Paolo Bonzini
On 13/03/2015 12:09, Shannon Zhao wrote: > +g_assert(strlen(path) < sizeof(helper.sun_path)); Ok. > sockfd = socket(AF_UNIX, SOCK_STREAM, 0); > if (sockfd < 0) { > fprintf(stderr, "failed to create socket: %s\n", strerror(errno)); > return -1; > } > -str

[Qemu-devel] [PATCH] hw/9pfs/virtio-9p-proxy: 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 --- hw/9pfs/virtio-9p-proxy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-