[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-trivial] [PATCH v2] fsdev/virtfs-proxy-helper: Fix possible ov
From: |
Aneesh Kumar K.V |
Subject: |
Re: [Qemu-trivial] [PATCH v2] fsdev/virtfs-proxy-helper: Fix possible overflow |
Date: |
Mon, 16 Mar 2015 12:01:24 +0530 |
User-agent: |
Notmuch/0.19+30~gd241a48 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu) |
Shannon Zhao <address@hidden> 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.
updated such that,
The socket name specified should fit in the sockadd_un.sun_path. If not
abort.
with that applied.
>
> Signed-off-by: Shannon Zhao <address@hidden>
> Signed-off-by: Shannon Zhao <address@hidden>
> ---
> v1->v2: Still use strcpy [Paolo]
> ---
> fsdev/virtfs-proxy-helper.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c
> index bf2e5f3..13fe032 100644
> --- a/fsdev/virtfs-proxy-helper.c
> +++ b/fsdev/virtfs-proxy-helper.c
> @@ -738,6 +738,7 @@ static int proxy_socket(const char *path, uid_t uid,
> gid_t gid)
> return -1;
> }
>
> + g_assert(strlen(path) < sizeof(proxy.sun_path));
> sock = socket(AF_UNIX, SOCK_STREAM, 0);
> if (sock < 0) {
> do_perror("socket");
> --
> 1.8.3.1