From patchwork Sat Nov 21 09:46:26 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 5756 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:6022:91c9:10b0:11b:d6c:f273 with SMTP id tl9-n1csp352696lad; Sat, 21 Nov 2026 01:46:48 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErFQ4HVcwEUtxFL9ABUTKtYcrSgExAYx14RlZRoAf2Zg0Tc86N4VQY7z0E0akpD8bsPecpVuqOoD0hg=@openvpn.net X-Received: by 2002:a05:7022:ed08:b0:195:76af:b810 with SMTP id a92af1059eb24-1b5568b08a2mr4734649c88.25.1795254408030; Sat, 21 Nov 2026 01:46:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1795254408; cv=none; d=google.com; s=arc-20260327; b=DbMjvaaOuzgnqsOt+lrBsIDcafznRgZOQq24i7CY+cWSGpGSFQlWwuHN4xEv33JEDI ndeD8UmHeT9JyqJi3i17znhke6ASXyTOegf9NHANkd2+8AFMpWpFKcVYF9WgW+vkFp9e wR5Fpn2fwz4OvpgFsgVbnZBEKNMHxeoAwtGqZF8d623zgq7LemSqwgXfEALZF6gKcKIZ h/D53QZcklGM7eMsCUf4KU9oVec5Mpx67JJq+/OocHjinGXM/0bQ8/6jPi6gWijuaG64 ywmSbQS9qd/IeeqQmh2m9qWY+DzYHwEF80OfouJlsnlBqEevlkNrqoU0X0A1s0LQDJvF 22fA== 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=KIDlovqcyLKbyssnWqf8T37ETg2luEP4bh2w/B87JSk=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=BbS6Gte6K7ZsVGLnrvAJZb9b9XECM0dVkdSDs48V8o4b1WnElKbwhSYdyQV2AwGeej ARpwaY2ZQ6ctWuXLzjZZ/S1rGhfqxA/4lms+19yF5dY9PAV04Y8rJXjxIlfnGQc93zAV +EWPXyTziGWDIBftbIFEAF/seQJco/onm/GEXIYnj+oXnPutggZumAOlPPkWHEIMhC7E S/EM6Iaz4oPfwO7/bdZ+UzIuR/+SVWl9FgJ6GpOon4WPk/ft5Hh95eOmbM12Q6GgX/6W 8JxTAXjXdolx5A/vLTMf9UB/5H31uvOdr2djEf91G78Y0g0EXcGUe/X5fprokegMvYRx 0iVw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=dSLUNHZS; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=BpmLZf4l; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=iQiyFMvT; 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 a92af1059eb24-1b559cb1d7esi16320281c88.30.2026.11.21.01.46.47 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 21 Nov 2026 01:46:48 -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=dSLUNHZS; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=BpmLZf4l; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=iQiyFMvT; 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=KIDlovqcyLKbyssnWqf8T37ETg2luEP4bh2w/B87JSk=; b=dSLUNHZSOgVB25 jHpC9qEkR9iBv01hXLWAbx0m57GkobTpVZHi3OFbfGvo28QQs0vxsYr7yzCpMnx395jxBQjdFOXxV YW6Pol9aFY6QgM2iCvbTJOckNSnuBd5siMgYk5AOk94iZ+jBqr70zczbsk3vep7YMcVgwi9+gUWfY 1VI=; Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.100.1) (envelope-from ) id 1xUhgB-000000002NY-1TQS; Sat, 21 Nov 2026 09:46:43 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.100.1) (envelope-from ) id 1xUhgA-000000002NN-01XJ for openvpn-devel@lists.sourceforge.net; Sat, 21 Nov 2026 09:46:42 +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=IYtJW0GaFgCuSs6eR3MmklJSPzwhjXhD89z6pQvq+AE=; b=BpmLZf4lfJCss/eMKQNW8YwFG/ alZ7tA78IpzJHDPM4lXdWZF+vfTfe0fFAueD82dxnykDyek25DlTSDJCvrT74FxOzWI7LASXfcGa/ IKZgqv7pk8d/LmUE1o4SidWLwUDvlN/dv3DsoA8qVgV7UxfEjtTuyqMF+vjbxE9MEmVU=; 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=IYtJW0GaFgCuSs6eR3MmklJSPzwhjXhD89z6pQvq+AE=; b=iQiyFMvTcR4sFL2tLC2rf43Q7/ v0NKUc6RyTJLPvJ1q+6QLW0Nx9U6OHuaN8QQ6LYnYbID911CNBaIzZhuKHllpw/4mmCUhOzogryYZ LWfxr7b5VMNveHKYMHjOI8Ro1Bl+1QJP3UzLL/hAhHLX55/F2Z0GpdD569DFcsUMaS5w=; 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 1xUhg8-0000000089P-38NT for openvpn-devel@lists.sourceforge.net; Sat, 21 Nov 2026 09:46:41 +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 6AL9kX6e028602 for ; Sat, 21 Nov 2026 10:46:33 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.2/8.18.1/Submit) id 6AL9kX5B028601 for openvpn-devel@lists.sourceforge.net; Sat, 21 Nov 2026 10:46:33 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Sat, 21 Nov 2026 10:46:26 +0100 Message-ID: <20261121094633.28585-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: Heiko Hund The buffers in GetItfDnsServersV4/V6() are NUL terminated at their start and their end at the start of the functions. For better readability use ZeroMemory() here. 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: 1xUhg8-0000000089P-38NT Subject: [Openvpn-devel] [PATCH v1] openvpnserv: zero name server bufs with ZeroMemory 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: 1882460686309917048 X-GMAIL-MSGID: 1882460686309917048 From: Heiko Hund The buffers in GetItfDnsServersV4/V6() are NUL terminated at their start and their end at the start of the functions. For better readability use ZeroMemory() here. Change-Id: I1249834b1899461bc8f01e848bea95e30decf60c Signed-off-by: Heiko Hund Acked-by: Razvan Cojocaru Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2236 --- 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/+/2236 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Razvan Cojocaru diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c index 7ea88a1..6c290ef 100644 --- a/src/openvpnserv/interactive.c +++ b/src/openvpnserv/interactive.c @@ -2177,8 +2177,7 @@ static LSTATUS GetItfDnsServersV4(HKEY itf_key, PSTR addrs, PDWORD size) { - addrs[0] = '\0'; - addrs[*size - 1] = '\0'; + ZeroMemory(addrs, *size); LSTATUS err; DWORD s = *size; @@ -2224,8 +2223,7 @@ static LSTATUS GetItfDnsServersV6(HKEY itf_key, PSTR addrs, PDWORD size) { - addrs[0] = '\0'; - addrs[*size - 1] = '\0'; + ZeroMemory(addrs, *size); LSTATUS err; DWORD s = *size;