From patchwork Tue Apr 13 06:16:55 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Juha.Riihimaki@nokia.com X-Patchwork-Id: 50023 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 93B11B7080 for ; Tue, 13 Apr 2010 16:23:56 +1000 (EST) Received: from localhost ([127.0.0.1]:34266 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O1ZSq-0003wl-11 for incoming@patchwork.ozlabs.org; Tue, 13 Apr 2010 02:19:12 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O1ZQu-0003wX-22 for qemu-devel@nongnu.org; Tue, 13 Apr 2010 02:17:12 -0400 Received: from [140.186.70.92] (port=41790 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O1ZQs-0003wF-IW for qemu-devel@nongnu.org; Tue, 13 Apr 2010 02:17:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O1ZQp-0006Sx-95 for qemu-devel@nongnu.org; Tue, 13 Apr 2010 02:17:09 -0400 Received: from smtp.nokia.com ([192.100.122.233]:49093 helo=mgw-mx06.nokia.com) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O1ZQn-0006Rp-Uc for qemu-devel@nongnu.org; Tue, 13 Apr 2010 02:17:06 -0400 Received: from vaebh106.NOE.Nokia.com (vaebh106.europe.nokia.com [10.160.244.32]) by mgw-mx06.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o3D6GUSF013998 for ; Tue, 13 Apr 2010 09:16:59 +0300 Received: from esebh102.NOE.Nokia.com ([172.21.138.183]) by vaebh106.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 13 Apr 2010 09:16:53 +0300 Received: from mgw-sa02.ext.nokia.com ([147.243.1.48]) by esebh102.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Tue, 13 Apr 2010 09:16:53 +0300 Received: from localhost.localdomain (esdhcp04150.research.nokia.com [172.21.41.50]) by mgw-sa02.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o3D6Gqhc007667 for ; Tue, 13 Apr 2010 09:16:52 +0300 From: juha.riihimaki@nokia.com To: qemu-devel@nongnu.org Date: Tue, 13 Apr 2010 09:16:55 +0300 Message-Id: <1271139415-32694-1-git-send-email-juha.riihimaki@nokia.com> X-Mailer: git-send-email 1.7.0.2 MIME-Version: 1.0 X-OriginalArrivalTime: 13 Apr 2010 06:16:53.0152 (UTC) FILETIME=[E90DAA00:01CADAD0] X-Nokia-AV: Clean X-MIME-Autoconverted: from 8bit to quoted-printable by mgw-mx06.nokia.com id o3D6GUSF013998 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) Subject: [Qemu-devel] [PATCH] slirp: fix structure initialization in tcp_listen() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Juha Riihimäki A data structure of type sockaddr_in is allocated from stack but not properly initialized. This may lead to a failure in the bind() call later on. Fixed by filling the contents of the structure with zeroes before using it. Signed-off-by: Juha Riihimäki --- slirp/socket.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/slirp/socket.c b/slirp/socket.c index 8a257ac..eaad77a 100644 --- a/slirp/socket.c +++ b/slirp/socket.c @@ -587,6 +587,7 @@ tcp_listen(Slirp *slirp, u_int32_t haddr, u_int hport, u_int32_t laddr, struct socket *so; int s, opt = 1; socklen_t addrlen = sizeof(addr); + memset(&addr, 0, addrlen); DEBUG_CALL("tcp_listen"); DEBUG_ARG("haddr = %x", haddr);