From patchwork Mon Nov 30 15:27:36 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 5821 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:6022:91c9:10b0:11b:d6c:f273 with SMTP id tl9-n1csp13135741lad; Mon, 30 Nov 2026 07:27:54 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErEC300HhTgeXM0BaNsK95eV2QITu4TXWK8AsG2eO90jyrlYIcZFmFY95R7AqgIbu0G+R+16PHfh+yI=@openvpn.net X-Received: by 2002:a17:903:440c:b0:2f1:4efb:5636 with SMTP id d9443c01a7336-2f14efb56c4mr29431225ad.61.1796052474327; Mon, 30 Nov 2026 07:27:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1796052474; cv=none; d=google.com; s=arc-20260327; b=qx3TxTfmcA2L1hSquKG74CbmRMSBzKQxJS0xhqOBnPfP2f15q44dEJ2yy1M1mP4IoQ Mjm/pq5PDH4IcpO1fiKBfrWcYJp+Bl765SDLdNoWRuXKCmLzXljot3HuPTogzp6e+hUG 3p4BG2A34Ghfw8I9ojVV9J0iaYSB9Qx2ycF5U8wmsE7TO7W6HXSBaEhof0I//+l2N9Ba bffsfouoUeFIyBDw8Vd80yeT5u4H5Lfyz8ii3vF7R+EXc5zhHS6U+TtYkGCI3qOfh5mt CUv9qxrucxkLlfcfvmTrJ6uvQ/uEkODIfpUj3XZXJ3cSVBhqiLUbNO3GTFSTN9cjxD9w SjqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature:dkim-signature; bh=et3IkOYx6iy7Ug7Kgjql7ApddkjLWj0EiqUt7wpSQds=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=JggC449ldDGVXh/0gi+YQMhJCoWyYwTmiLYqcebhEIz9OHYLdXie944lpjVhM7DeF8 O3fuTv9oG4aaQ45kTcvAqqQgxlTOqHBKA08LeFWw33G67zjQfZQFn2HnBg6p0WBjHvXq L/nn5v4pvJPfLL8OKJQA/f2xWUVxlOr/FL9RSg7gTFNGJCQ2bNYvyAIPY0Vdhh8c/ZHn BU7CpJ5K/4su7GgOjDOYKb/Cu/6fXzTxmFOFo9MdLHlCMQH0sV3+2klNHd6EzyUTOgqm uu5UWBrH5niMLDKlVzGh1qHtN/Bc8w/YQu0BjkTj6USsj63I5tMxJioeVMU2jAI92lLt lOoA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=EViS28Oa; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=mittdJgQ; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=nSEQR9Zo; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id d9443c01a7336-2f03f1722a8si712297395ad.110.2026.11.30.07.27.54 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Nov 2026 07:27:54 -0800 (PST) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=EViS28Oa; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=mittdJgQ; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=nSEQR9Zo; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:MIME-Version:References:In-Reply-To:Message-ID:Date:To:From:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=et3IkOYx6iy7Ug7Kgjql7ApddkjLWj0EiqUt7wpSQds=; b=EViS28Oa6zUL1m ZcTNBsZXiwUzkP7/TOGbw1rOmBmz9a9uAnn84lAUX+LyG8QZfH0UDnWo+mgSKSpEBnyjNUx2eEi5j SgaHVcY0VrRuqf6+hRayzNJ2JRFj7f7MFnc8HCuSwfvLUSaYUI60LI+ZyAZ+tKBJG+sxLgUnSWMLN ueQ=; 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.100.1) (envelope-from ) id 1xY3IH-000000007w9-0YWm; Mon, 30 Nov 2026 15:27:53 +0000 Received: from [172.30.29.66] (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.100.1) (envelope-from ) id 1xY3IG-000000007vw-04h0 for openvpn-devel@lists.sourceforge.net; Mon, 30 Nov 2026 15:27:52 +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-Unsubscribe-Post:List-Subscribe:List-Post:List-Owner:List-Archive; bh=o3/srIdz7fLotnl1wu3MiveDdEGJ8m/RXhEPszb8mdE=; b=mittdJgQXJ5BfHAaiF0oCMFYUk rULHrQDR+YfLWr6FHfYgcqMpbaBhwTFnzw/Zt1wu2klxtBZBzxeCSCNs9EJioKW6BdPIlBBZ+krd9 5iV1e5XrFHYnj2sn1PX27r/5w6YgqvQIuW4M1sPONUmX7k3fK2mu/1PEoLqVAu2SGolM=; 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-Unsubscribe-Post: List-Subscribe:List-Post:List-Owner:List-Archive; bh=o3/srIdz7fLotnl1wu3MiveDdEGJ8m/RXhEPszb8mdE=; b=nSEQR9ZoRITaWuClmrhVkMdl5L 93TX8JO7mIIOhqjRjsK5/N59nTvsXXqo1WH1DtijKzkykZ+jJJkRkKN7Onod5PKgIq7cfa/U5kALR EUYu3z7sjK9E5/WbW17oqmZhHISDE6DjE/6kV1Y1Jty/6SdUHeGLiPFxxCFCzSNw3yY4=; Received: from [193.149.48.129] (helo=blue.greenie.muc.de) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.100.1) id 1xY3ID-000000007WB-0ULZ for openvpn-devel@lists.sourceforge.net; Mon, 30 Nov 2026 15:27:51 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.18.1/8.18.1) with ESMTP id 6AUFRgcs017676 for ; Mon, 30 Nov 2026 16:27:42 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.2/8.18.1/Submit) id 6AUFRg5G017675 for openvpn-devel@lists.sourceforge.net; Mon, 30 Nov 2026 16:27:42 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Mon, 30 Nov 2026 16:27:36 +0100 Message-ID: <20261130152742.17661-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.55.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "sfi-spamd-1.hosts.colo.sdot.me", 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: Razvan Cojocaru "tapctl list --hwid" without a value crashed in wcslen(), and a value too long for the hardware ID buffer made memcpy_s() fail. Warn and ignore --hwid in both cases, as the create command does. Content analysis details: (1.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Headers-End: 1xY3ID-000000007WB-0ULZ Subject: [Openvpn-devel] [PATCH v1] tapctl: don't crash on a missing list --hwid value 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-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: 1883297518974253244 X-GMAIL-MSGID: 1883297518974253244 From: Razvan Cojocaru "tapctl list --hwid" without a value crashed in wcslen(), and a value too long for the hardware ID buffer made memcpy_s() fail. Warn and ignore --hwid in both cases, as the create command does. Change-Id: I21c051e6fa7b89904da2d4d6ec4770c94bc44af7 Signed-off-by: Razvan Cojocaru Acked-by: Frank Lichtenheld Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2376 --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2376 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Frank Lichtenheld diff --git a/src/tapctl/main.c b/src/tapctl/main.c index 6697d14..12ab270 100644 --- a/src/tapctl/main.c +++ b/src/tapctl/main.c @@ -512,11 +512,20 @@ { if (wcsicmp(argv[i], L"--hwid") == 0) { + if (++i >= argc) + { + fwprintf(stderr, L"--hwid option requires a value. Ignored.\n"); + break; + } + /* leave room for the two terminating zeros */ + size_t len = wcslen(argv[i]); + if (len > _countof(szzHwId) - 2) + { + fwprintf(stderr, L"--hwid value is too long. Ignored.\n"); + continue; + } memset(szzHwId, 0, sizeof(szzHwId)); - ++i; - memcpy_s(szzHwId, - sizeof(szzHwId) - 2 * sizeof(WCHAR), - argv[i], wcslen(argv[i]) * sizeof(WCHAR)); + wmemcpy(szzHwId, argv[i], len); } else {