From patchwork Tue Jul 15 14:24:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 33670 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2051A20CAD for ; Tue, 15 Jul 2014 14:27:39 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id wp18sf31131861obc.1 for ; Tue, 15 Jul 2014 07:27:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=QUmfLCIKaVBLCMhaBxwN2WUOMxHt9NP5Cbi2E3mB9bA=; b=AlavelRYmafmvpA42UFGXXgTG+gB5/GAetFYbW1ibfwijEFVdC6fVT0j30cuF9Tspt d1sqa+UeFPylff9W+3Nt/cex913ZzoFuMdADshdAoOFL1qS1Skz4vCqyrvNOL3LFJS0w lzrl3MU9WWje7xOczqtjp0ciqNJFR84pdLAKrBwB7aG4oZBk29Wkgz7kUiI087HmpGPk VnW+DpaJyqgKMpF5zPPvkyXTu8IknrqqEXKtt76xWl6Rx99x7Y208VJxsbn/CYeJaN+G 2zQsNTl2bg9t/20gxmCdFS5/2iOpRFtwsGDSlJUMdygmSZwBSCUj3B+Tb2RTmRI0F7iM jlOQ== X-Gm-Message-State: ALoCoQl+nvC8FHCo7DoM4/Jx7Y5xwytQ+qwGJ3nsGHohAKhhRRWl6gdFnL/t3dVDg+xgK0wC6m9h X-Received: by 10.42.15.197 with SMTP id m5mr12227789ica.31.1405434458692; Tue, 15 Jul 2014 07:27:38 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.96.6 with SMTP id j6ls108221qge.89.gmail; Tue, 15 Jul 2014 07:27:38 -0700 (PDT) X-Received: by 10.220.1.70 with SMTP id 6mr1039544vce.62.1405434458505; Tue, 15 Jul 2014 07:27:38 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id o5si6793269vcj.31.2014.07.15.07.27.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 15 Jul 2014 07:27:38 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id id10so10212079vcb.24 for ; Tue, 15 Jul 2014 07:27:38 -0700 (PDT) X-Received: by 10.221.34.13 with SMTP id sq13mr22944977vcb.16.1405434458403; Tue, 15 Jul 2014 07:27:38 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp218965vcb; Tue, 15 Jul 2014 07:27:37 -0700 (PDT) X-Received: by 10.140.81.134 with SMTP id f6mr15399160qgd.60.1405434457835; Tue, 15 Jul 2014 07:27:37 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id x64si20886483qgx.80.2014.07.15.07.27.37 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 15 Jul 2014 07:27:37 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:34988 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X73hh-0000ol-F9 for patch@linaro.org; Tue, 15 Jul 2014 10:27:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32903) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X73fI-0005h0-8O for qemu-devel@nongnu.org; Tue, 15 Jul 2014 10:25:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X73fA-0007Wl-Dh for qemu-devel@nongnu.org; Tue, 15 Jul 2014 10:25:08 -0400 Received: from [2001:4b98:dc0:45:216:3eff:fe3d:166f] (port=52391 helo=afflict.kos.to) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X73fA-0007W9-6Y for qemu-devel@nongnu.org; Tue, 15 Jul 2014 10:25:00 -0400 Received: from afflict.kos.to (afflict [92.243.29.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by afflict.kos.to (Postfix) with ESMTPSA id 27DE826552; Tue, 15 Jul 2014 16:24:59 +0200 (CEST) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Tue, 15 Jul 2014 17:24:56 +0300 Message-Id: <2dd08dfd9a553af3d53c6508e436b0c2aa5a469b.1405434118.git.riku.voipio@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 2001:4b98:dc0:45:216:3eff:fe3d:166f Cc: Peter Maydell , Joakim Tjernlund Subject: [Qemu-devel] [PULL for-2.1 4/5] alloca one extra byte sockets X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: riku.voipio@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Joakim Tjernlund target_to_host_sockaddr() may increase the lenth with 1 byte for AF_UNIX sockets so allocate 1 extra byte. Signed-off-by: Joakim Tjernlund Reviewed-by: Peter Maydell Signed-off-by: Riku Voipio --- 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 7163ade..a50229d 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -1984,7 +1984,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) @@ -2005,7 +2005,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) { @@ -2268,7 +2268,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);