From patchwork Mon May 16 08:56:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kristof Provost via Openvpn-devel X-Patchwork-Id: 2465 X-Patchwork-Delegate: a@unstable.cc Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director15.mail.ord1d.rsapps.net ([172.28.255.1]) by backend41.mail.ord1d.rsapps.net with LMTP id MNbVAKSegmIeDQAAqwncew (envelope-from ) for ; Mon, 16 May 2022 14:57:40 -0400 Received: from proxy9.mail.ord1c.rsapps.net ([172.28.255.1]) by director15.mail.ord1d.rsapps.net with LMTP id MKRsBaSegmKEBgAAIcMcQg (envelope-from ) for ; Mon, 16 May 2022 14:57:40 -0400 Received: from smtp28.gate.ord1c ([172.28.255.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy9.mail.ord1c.rsapps.net with LMTPS id IPMFBaSegmLTeAAAgxtkuw (envelope-from ) for ; Mon, 16 May 2022 14:57:40 -0400 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp28.gate.ord1c.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; 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=netgate.com; dmarc=pass (p=none; dis=none) header.from=lists.sourceforge.net X-Suspicious-Flag: YES X-Classification-ID: 0e5f7d66-d54a-11ec-a9dd-a0369f1890f1-1-1 Received: from [216.105.38.7] ([216.105.38.7:54900] helo=lists.sourceforge.net) by smtp28.gate.ord1c.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 42/8A-31896-3AE92826; Mon, 16 May 2022 14:57:39 -0400 Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.94.2) (envelope-from ) id 1nqftV-0002OQ-0u; Mon, 16 May 2022 18:56:36 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nqftS-0002OJ-Qz for openvpn-devel@lists.sourceforge.net; Mon, 16 May 2022 18:56:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=RA8FPEsQbP4hZloUxhAc1wAPsYsQJytOZN3DWPfzARg=; b=PV3YoEkVR9TcTRVebwwZTzfCi2 m9qOsXy6/aJunOXgByS7y6Q/56n2H5EWyAQahbF0cwNWpH6UzycM7ByKMfK6BFnFT8Sp4zzNpXKYX nsWKSw2HymwJMMPDqoAqTOBgNTbE8oG/v3N/t3qPugSvmqOXFe2imc9cAkAFrZy9SCG8=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=RA8FPEsQbP4hZloUxhAc1wAPsYsQJytOZN3DWPfzARg=; b=YWeGc7+7+VSYxi6LB9MhICfsjR U/I+dou6w2SUy5fbCF8Pt1t+ypi3J2erJdUOgEnF+2E/DL8XYqc+dYmtZzQRr8M6sVMhr339fl2kh 1K9yYNfBFcthL0SEvF3ThZQ7UTvN1m9eb6U0dQNWbw2dIiRsfOFDn+Ocw6hIOLIUVgxA=; Received: from mail-wr1-f52.google.com ([209.85.221.52]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.94.2) id 1nqftQ-0006Ub-Bl for openvpn-devel@lists.sourceforge.net; Mon, 16 May 2022 18:56:33 +0000 Received: by mail-wr1-f52.google.com with SMTP id w4so21702685wrg.12 for ; Mon, 16 May 2022 11:56:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netgate.com; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=RA8FPEsQbP4hZloUxhAc1wAPsYsQJytOZN3DWPfzARg=; b=Xq22+yUvTKNGYmMdvfPfE0SoYrZcPYpm8osiTlls+LzdBz24SsJQ/rEk2nZF+H45WM FbvngBv+qnQT8BUfZOIwlpoMIaOWGTTreUgT3BLPwGeCacHFKXCvvf5jT2NcDq2rMSG9 mmLsxEz8k/lTGcJQXDdnN4fu6FeH8wqRJlFf8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RA8FPEsQbP4hZloUxhAc1wAPsYsQJytOZN3DWPfzARg=; b=jAQFeNYMcvJDFAtriXvurUqwhllHBOqcdReAxYbVVhgVOWvig9BoXJDpAdSUHcVnUd Nmv0CcFoW0YLMLB5KUWzVNpaG6VKCYJGf03YouZVTZVctkyoLTM0HGp2ao+UZ+pcgAsE 7RNYbl3v2Wzzupjx61Emfybc3vLUry0ywMD8czQmpoRwkcvb+L3ONTJvQ0PH/UzGF306 LuEDGYb7lQslXHHL86Kqp6AvITkeI8wu4dTX9WCmXk0liZLLAh5H/EYzpGTUW1Akn2LL dEdGtkOZJr0dAWb3luZOMhysk9geBsku0SeLEvOLpFlfIYDvTpRAeN4jQUhTLwHbr1Sv BVqQ== X-Gm-Message-State: AOAM530azopiQzDAU4I96EAzOgW6Hu9NrpQxCd87bRckAUEjoUiGYA6h CtzE9v/bpqKyCbdQKbX+McDED1iIXAfhQQ== X-Google-Smtp-Source: ABdhPJxnaohPcIf1p6LKSXZ5WQHleo+ddtLYPtE9QbbRYq6M6QgbUIxSxqb3aA9e9lWYzyaeWIcQng== X-Received: by 2002:a5d:6d84:0:b0:20c:73d1:2f8b with SMTP id l4-20020a5d6d84000000b0020c73d12f8bmr14955375wrs.520.1652727385700; Mon, 16 May 2022 11:56:25 -0700 (PDT) Received: from nut.jupiter.sigsegv.be (ptr-8rgvk5277arubwggeqg.18120a2.ip6.access.telenet.be. [2a02:1811:240d:2900:f602:70ff:feae:6e98]) by smtp.googlemail.com with ESMTPSA id 14-20020a05600c24ce00b003942a244ee1sm40075wmu.38.2022.05.16.11.56.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 May 2022 11:56:25 -0700 (PDT) To: openvpn-devel Date: Mon, 16 May 2022 20:56:18 +0200 Message-Id: <20220516185621.6182-2-kprovost@netgate.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220516185621.6182-1-kprovost@netgate.com> References: <20220516185621.6182-1-kprovost@netgate.com> MIME-Version: 1.0 X-Spam-Report: Spam detection software, running on the system "util-spamd-1.v13.lw.sourceforge.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Kristof Provost multi_create_instance() can fail (i.e. return NULL). multi_create_instance_tcp() is ready for this, but called multi_assign_peer_id() without first checking if mi was non-NULL. multi_assign_peer_id() [...] Content analysis details: (-0.2 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.221.52 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.221.52 listed in wl.mailspike.net] X-Headers-End: 1nqftQ-0006Ub-Bl Subject: [Openvpn-devel] [PATCH 1/4] mtcp: Handle multi_create_instance() returning NULL 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: , X-Patchwork-Original-From: Kristof Provost via Openvpn-devel From: Kristof Provost via Openvpn-devel Reply-To: Kristof Provost Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox From: Kristof Provost multi_create_instance() can fail (i.e. return NULL). multi_create_instance_tcp() is ready for this, but called multi_assign_peer_id() without first checking if mi was non-NULL. multi_assign_peer_id() assumed that mi is non-NULL, dereferencing it and causing a crash. Move the call to multi_assign_peer_id() after the mi NULL check. Signed-off-by: Kristof Provost Acked-By: Arne Schwabe hash; mi = multi_create_instance(m, NULL); - multi_assign_peer_id(m, mi); if (mi) { @@ -132,6 +131,8 @@ multi_create_instance_tcp(struct multi_context *m) const uint32_t hv = hash_value(hash, &mi->real); struct hash_bucket *bucket = hash_bucket(hash, hv); + multi_assign_peer_id(m, mi); + he = hash_lookup_fast(hash, bucket, &mi->real, hv); if (he)