From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56079) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X72nY-00022D-SB for qemu-devel@nongnu.org; Tue, 15 Jul 2014 09:29:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X72nT-00040m-0b for qemu-devel@nongnu.org; Tue, 15 Jul 2014 09:29:36 -0400 Received: from afflict.kos.to ([92.243.29.197]:37150) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X72nS-00040Y-Pw for qemu-devel@nongnu.org; Tue, 15 Jul 2014 09:29:30 -0400 Date: Tue, 15 Jul 2014 16:29:30 +0300 From: Riku Voipio Message-ID: <20140715132930.GB607@afflict.kos.to> References: <1405091884-29955-1-git-send-email-Joakim.Tjernlund@transmode.se> <1405091884-29955-4-git-send-email-Joakim.Tjernlund@transmode.se> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1405091884-29955-4-git-send-email-Joakim.Tjernlund@transmode.se> Subject: Re: [Qemu-devel] [PATCH 3/4] alloca one extra byte sockets List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Joakim Tjernlund Cc: qemu-devel@nongnu.org On Fri, Jul 11, 2014 at 05:18:03PM +0200, Joakim Tjernlund wrote: > target_to_host_sockaddr() may increase the lenth with 1 byte > for AF_UNIX sockets so allocate 1 extra byte. Thanks, applied to linux-user tree > Signed-off-by: Joakim Tjernlund > --- > linux-user/syscall.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/linux-user/syscall.c b/linux-user/syscall.c > index a0e1ccc..8853c4e 100644 > --- a/linux-user/syscall.c > +++ b/linux-user/syscall.c > @@ -1978,7 +1978,7 @@ static abi_long do_connect(int sockfd, abi_ulong target_addr, > return -TARGET_EINVAL; > } > > - addr = alloca(addrlen); > + addr = alloca(addrlen+1); > > ret = target_to_host_sockaddr(addr, target_addr, addrlen); > if (ret) > @@ -1999,7 +1999,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp, > > if (msgp->msg_name) { > msg.msg_namelen = tswap32(msgp->msg_namelen); > - msg.msg_name = alloca(msg.msg_namelen); > + msg.msg_name = alloca(msg.msg_namelen+1); > ret = target_to_host_sockaddr(msg.msg_name, tswapal(msgp->msg_name), > msg.msg_namelen); > if (ret) { > @@ -2262,7 +2262,7 @@ static abi_long do_sendto(int fd, abi_ulong msg, size_t len, int flags, > if (!host_msg) > return -TARGET_EFAULT; > if (target_addr) { > - addr = alloca(addrlen); > + addr = alloca(addrlen+1); > ret = target_to_host_sockaddr(addr, target_addr, addrlen); > if (ret) { > unlock_user(host_msg, msg, 0); > -- > 1.8.5.5 >