From patchwork Tue Jan 2 17:02:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selva Nair X-Patchwork-Id: 156 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director4.mail.ord1d.rsapps.net ([172.28.255.1]) by backend31.mail.ord1d.rsapps.net (Dovecot) with LMTP id xI1PC4v8TVorMwAAgoeIoA for ; Thu, 04 Jan 2018 05:06:03 -0500 Received: from director5.mail.ord1c.rsapps.net ([172.28.255.1]) by director4.mail.ord1d.rsapps.net (Dovecot) with LMTP id 45GLL4v8TVpCQgAAHDmxtw ; Thu, 04 Jan 2018 05:06:03 -0500 Received: from smtp22.gate.ord1c ([172.28.255.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by director5.mail.ord1c.rsapps.net (Dovecot) with LMTP id mXddFYv8TVp2UAAAH8LYwg ; Thu, 04 Jan 2018 05:06:03 -0500 X-Spam-Exception: WHITELISTED X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: patchwork@openvpn.net X-Originating-Ip: [108.166.43.93] Authentication-Results: smtp22.gate.ord1c.rsapps.net; iprev=pass policy.iprev="108.166.43.93"; spf=pass smtp.mailfrom="samuli@openvpn.net" smtp.helo="smtp93.ord1c.emailsrvr.com"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dkim=fail (signature verification failed) header.d=gmail.com; dmarc=fail (p=none; dis=none) header.from=gmail.com X-Classification-ID: df1ade02-f136-11e7-9b1a-a0369f0d84d2-1-1 Received: from [108.166.43.93] ([108.166.43.93:57780] helo=smtp93.ord1c.emailsrvr.com) by smtp22.gate.ord1c.rsapps.net (envelope-from ) (ecelerity 4.2.1.56364 r(Core:4.2.1.14)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 3F/C0-26553-B8CFD4A5; Thu, 04 Jan 2018 05:06:03 -0500 Received: from smtp4.relay.ord1c.emailsrvr.com (localhost [127.0.0.1]) by smtp4.relay.ord1c.emailsrvr.com (SMTP Server) with ESMTP id 2807AA0350 for ; Thu, 4 Jan 2018 05:06:03 -0500 (EST) X-Auth-ID: samuli@openvpn.net Received: by smtp4.relay.ord1c.emailsrvr.com (Authenticated sender: samuli-AT-openvpn.net) with ESMTPSA id 9387CA00F3 for ; Thu, 4 Jan 2018 05:06:01 -0500 (EST) X-Sender-Id: samuli@openvpn.net Received: from [192.168.15.45] (91-159-32-223.elisa-laajakaista.fi [91.159.32.223]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA) by 0.0.0.0:465 (trex/5.7.12); Thu, 04 Jan 2018 05:06:03 -0500 Resent-From: =?utf-8?q?Samuli_Sepp=C3=A4nen?= Resent-To: patchwork@openvpn.net Resent-Date: Thu, 4 Jan 2018 12:05:58 +0200 Resent-Message-ID: Resent-User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 Received: from MBX10D-ORD1.mex06.mlsrvr.com (172.29.1.29) by MBX10C-ORD1.mex06.mlsrvr.com (172.29.1.28) with Microsoft SMTP Server (TLS) id 15.0.1293.2 via Mailbox Transport; Tue, 2 Jan 2018 22:15:41 -0600 Received: from MBX01D-ORD1.mex06.mlsrvr.com (172.29.1.2) by MBX10D-ORD1.mex06.mlsrvr.com (172.29.1.29) with Microsoft SMTP Server (TLS) id 15.0.1293.2; Tue, 2 Jan 2018 22:15:40 -0600 Received: from gate.forward.smtp.ord1c.emailsrvr.com (108.166.43.128) by MBX01D-ORD1.mex06.mlsrvr.com (172.29.1.2) with Microsoft SMTP Server (TLS) id 15.0.1293.2 via Frontend Transport; Tue, 2 Jan 2018 22:15:40 -0600 Received: from [216.34.181.88] ([216.34.181.88:5140] helo=lists.sourceforge.net) by smtp38.gate.ord1c.rsapps.net (envelope-from ) (ecelerity 4.2.1.56364 r(Core:4.2.1.14)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 2D/40-12758-CE85C4A5; Tue, 02 Jan 2018 23:15:40 -0500 Received: from localhost ([127.0.0.1] helo=sfs-ml-1.v29.ch3.sourceforge.com) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.89) (envelope-from ) id 1eWaRq-0005sv-Ol; Wed, 03 Jan 2018 04:14:38 +0000 Received: from sfi-mx-4.v28.ch3.sourceforge.com ([172.29.28.194] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1eWaRp-0005sp-Ov for openvpn-devel@lists.sourceforge.net; Wed, 03 Jan 2018 04:14:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=tKxZaf5Ycrda4qo+zlP3nf+o/TeXw/M8hMUFJZNLscw=; b=aRujlbmuIj+Qqb5JrCeXf73P11 LndZoaCaLaSmkA9Svp+ApvEm+Op8D2NcEt+GMLHyumUP3Z5yR/e2A0BP9j8imLZtQTTuF/HlG24H8 Fyw5wHh6WHlBycyXp7CNn3Z09AdXxtj1b8iKQz4TD07hYeHv7QbTPKtaR1C3+6EAy4qU=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version: Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=tKxZaf5Ycrda4qo+zlP3nf+o/TeXw/M8hMUFJZNLscw=; b=RIdET8DeYTUCzD06wtIzZwfhSk YR4m4V5YBQAbaNzUPdhhku5N2Ccn6ClkW9+8HgsuXOG+WWOsCGpYaGFNHaS2ardVu8zUhZoJlS2sD 9hgmPlYv4d/5KJU3tQAwkS3qurpBPFHPRGksQyFrYb94dHGGE8yoZj44u1RcK/rPFEWI=; Received: from mail-it0-f67.google.com ([209.85.214.67]) by sfi-mx-4.v28.ch3.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.89) id 1eWaRn-0006yb-K4 for openvpn-devel@lists.sourceforge.net; Wed, 03 Jan 2018 04:14:37 +0000 Received: by mail-it0-f67.google.com with SMTP id d16so450602itj.1 for ; Tue, 02 Jan 2018 20:14:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=tKxZaf5Ycrda4qo+zlP3nf+o/TeXw/M8hMUFJZNLscw=; b=Ox4zlG9rZaCafJP9PyY8Vdd0lM+LNtAs4pRQqrPybX3qLsIUFKBaD8IU3assqZRi32 GVpzdKZVQxzNoxEbCLmNnF9RN6fDWsKViTk+1nuHm0/7Srn/LuVGwVZMivsXpOEOaE11 mmIL3kv1Tx7g6eeFXJPLSuaJi8VsRh6/zmVokmsRmwWokanVQm9N/yhcbfs6eYEInkaN WCV8NLlQSXj1uHTiQK1b2fk/qzX9LESSQlocM8eRedzYMj3JLNVWRhIdcDTdyvcHugxX Zz0kCYAF9jn7OFVQR8g+VbT0oSYXa1ceOMmV4zCQpqFxHdaUDzU0N+Tb3i/55+WqJp0J 7JQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=tKxZaf5Ycrda4qo+zlP3nf+o/TeXw/M8hMUFJZNLscw=; b=PzlAbo9KemgbRG96dJv+btu7CJ7kaL2pm3JcaIJ5OR7mjkAvtSG3LMdVeMh7J2uNdP cVi/DnFaeRI/i4MFaTvI25QYPAB9Co1kXX/77AE+/nOvuB7dHF48LtjCWyIpQrHRKptQ XJrx5MO1usao3Vuru6bNWhyF0amJLMbrFpW7u4WK27D41YRzRrSwNyMkJ+IQuN+vROcN mToO1IKSogywfE4/jzmsj2f4abotASvC7joj0m77x63Eql+HDBbZjNfTi2bE52tKDFOs YpdWf7lbSaNu/yI6l8Sf3GA3J1/CePoEO9cJkISOVz6z8kiaW8EbfjtTixH6NIiyjlak OcZw== X-Gm-Message-State: AKGB3mJOvoB5YVplol9Dx9eFEdhp73KiTTOfTZC6NqwRWpPYppDw0K3x o8n1jMe+vxEwmaDW/hNH2p+Byk53 X-Google-Smtp-Source: ACJfBouZADTT6rkAtvrk1aYEBlAqPHhcofadvmrNtfICFMkRpZWR+dinAjwM5drpBzpL6mrPD0pevg== X-Received: by 10.36.61.144 with SMTP id n138mr457508itn.109.1514952870057; Tue, 02 Jan 2018 20:14:30 -0800 (PST) Received: from saturn.home.sansel.ca (CPE40167ea0e1c2-CM788df74daaa0.cpe.net.cable.rogers.com. [99.228.215.92]) by smtp.gmail.com with ESMTPSA id r67sm82715ioi.30.2018.01.02.20.14.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 Jan 2018 20:14:29 -0800 (PST) From: selva.nair@gmail.com To: openvpn-devel@lists.sourceforge.net Date: Tue, 2 Jan 2018 23:02:03 -0500 Message-ID: <1514952123-26616-1-git-send-email-selva.nair@gmail.com> X-Mailer: git-send-email 2.1.4 X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (selva.nair[at]gmail.com) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [209.85.214.67 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-Headers-End: 1eWaRn-0006yb-K4 Subject: [Openvpn-devel] [PATCH] Return NULL if GetAdaptersInfo fails X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-MS-Exchange-Organization-Network-Message-Id: 3a664e27-6fa5-444f-17f3-08d55260a657 X-MS-Exchange-Organization-AVStamp-Mailbox: SMEXzs^g;1387900;0;This mail has been scanned by Trend Micro ScanMail for Microsoft Exchange; X-MS-Exchange-Organization-AuthSource: MBX01D-ORD1.mex06.mlsrvr.com X-MS-Exchange-Organization-AuthAs: Anonymous MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: Inbox From: Selva Nair - Currently a pointer to potentially uninitialized IP_ADAPTER_INFO struct is returned on error causing ill-defined behaviour. Signed-off-by: Selva Nair Acked-by: Steffan Karger Acked-by: Simon Rozman --- There have been some reports of unexpected failure in GetAdaptersInfo. When and why that happens is still unclear but this bug could explain why the process goes into a tailspin in such occasions. src/openvpn/tun.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index 25831ce..6e16348 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -4178,15 +4178,12 @@ get_adapter_info_list(struct gc_arena *gc) else { pi = (PIP_ADAPTER_INFO) gc_malloc(size, false, gc); - if ((status = GetAdaptersInfo(pi, &size)) == NO_ERROR) - { - return pi; - } - else + if ((status = GetAdaptersInfo(pi, &size)) != NO_ERROR) { msg(M_INFO, "GetAdaptersInfo #2 failed (status=%u) : %s", (unsigned int)status, strerror_win32(status, gc)); + pi = NULL; } } return pi;