From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35623) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YWP3i-00082z-S3 for qemu-devel@nongnu.org; Fri, 13 Mar 2015 08:51:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YWP3i-000122-2s for qemu-devel@nongnu.org; Fri, 13 Mar 2015 08:51:22 -0400 Message-ID: <5502DD35.60803@redhat.com> Date: Fri, 13 Mar 2015 13:51:01 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1426244997-11392-1-git-send-email-zhaoshenglong@huawei.com> In-Reply-To: <1426244997-11392-1-git-send-email-zhaoshenglong@huawei.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] fsdev/virtfs-proxy-helper: Fix possible overflow List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Shannon Zhao , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, hangaohuai@huawei.com, qemu-trivial@nongnu.org, mjt@tls.msk.ru, peter.huangpeng@huawei.com, aneesh.kumar@linux.vnet.ibm.com, shannon.zhao@linaro.org 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) > umask(7); > > proxy.sun_family = AF_UNIX; > - strcpy(proxy.sun_path, path); > + strncpy(proxy.sun_path, path, sizeof(proxy.sun_path)); > if (bind(sock, (struct sockaddr *)&proxy, Same as the other patch. Paolo