From patchwork Mon Nov 24 17:00:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4627 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:6c3:b0:7b1:439f:bdf with SMTP id j3csp2020255maw; Mon, 24 Nov 2025 09:01:13 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWB6HS3C0mETbqDlYj57w+0kyjzS+ust8/2uSGshNUeKypnybqGj9y9g174wJTUW0rwDPkHqb7A3Sw=@openvpn.net X-Google-Smtp-Source: AGHT+IEXH6iGxxL7NvBVnsECKCiuEc0SyHiFmxf1aj/wuZT8XfazLSO3wqqr3e97U5XEuC099CX4 X-Received: by 2002:a05:6830:668f:b0:7c6:e8d7:3ac7 with SMTP id 46e09a7af769-7c798b6b262mr7950925a34.12.1764003673220; Mon, 24 Nov 2025 09:01:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1764003673; cv=none; d=google.com; s=arc-20240605; b=glMcnNbBuNORvts0XrxiFf4ElSulC6KKUbxaGaA0heWFsvbEFAFg2s+BSyKA/Ob3eq KK+yvCkmLlfbqLQDbrD3U/DqkAqjaEfe1xQZg+hy8rtr+Gs0+Qce5yghah1TFppz9Qwi oACeWYX6i8Tm1vpU57Ro1loDsS3UcEyxsEueK2IYte1DNs+qZfxkQn0QRfg9JAzgj+Nk /UgLTopwqrjetHSAtZFrrdDGMlO2489ZD5le2Fhb5lDRZsWWJHRjRLQD1I9PySvtW7Dh B2wHcnkNuQ6vxu47+K8ho3EYjHMy8IlKRSXGcz5uLPM2EYGZOd9mQWJIRV8Ior2ejPTd H/IQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=WNZgpYQL8BiunZZnanjw/MJmYt9/5mhWdUsMGjm1h4k=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=fbzgGwj3p9OrSnxXJWmxOUpwyNdiWD1DxOHp4rj/2b+dscJSbYdoWeiGFnlOusTrFC lsBIaK0mE3JswsYwxHSmArLltOIY6hrF1lq2ThBbRiOx1Y1+OL3S8J4Yb3b61FVyvguQ F/2r8UUKjzMoo2Vg3H6anPqyi164PDhJaeVzeBrL/Bk9viVq4eZ5ro07zrxPhF402W7/ 56VAgOR2ZglgZj4OZSyDRNoS5vFJqbgQ1Rs6M4ImxkrihPeqhr/pn6Aww7sOG4ViFrad Oznkbs8vrP/lgRnU1kFuSsKNT2kHtqE0v17pu0AGBjPFIxgMIIUnEnaRX0aWjo/Av9Vn QZCA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=biMfRWu4; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=NSlEfsNQ; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b="Phgq9CI/"; 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 46e09a7af769-7c78d3270e3si2292497a34.134.2025.11.24.09.01.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Nov 2025 09:01:12 -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=biMfRWu4; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=NSlEfsNQ; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b="Phgq9CI/"; 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-Owner; bh=WNZgpYQL8BiunZZnanjw/MJmYt9/5mhWdUsMGjm1h4k=; b=biMfRWu4R7/wGzq1XPVApyxJrY XsznDvgvJ/5O9ZJgcVw8UCFDieZHzJDG8aEGSnTN7OGPlc/DHeiOKeV8PvBDRSsWM526ZWN89ZbxE 1EImnTAHnYooM2bKsDViXDleOPTLUzfm3RRPpNav7Ti/ar+DC9SY/ORN1yCywynlBx54=; Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1vNZw4-0007h3-Tz; Mon, 24 Nov 2025 17:01:08 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1vNZw3-0007gw-QD for openvpn-devel@lists.sourceforge.net; Mon, 24 Nov 2025 17:01:07 +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=jJa3rAM0Kosq9zrekKJNt491yHsd24VWqvbnnS0I0Iw=; b=NSlEfsNQZdCJxIZf92owNSQlgQ BVqXFu6YC+zmqn3Vpa6PxRARvIAmB+6ImQab5d7Wz2+Q+S23LYX2OsfgG2gKibPUgXIbVpAXUkk9i 7e6s7fel8fgrX2TTVp6EEIUsy0TOHCnIbl2EH4zSJ8hpLfiwVh97xIxgedVlx6iEZBmE=; 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=jJa3rAM0Kosq9zrekKJNt491yHsd24VWqvbnnS0I0Iw=; b=Phgq9CI/TU1LFDgPq7UI0CC9U/ k8i8606DxKWBq9BZgkQbUtLp03rBs+Lus+53mjFdWG5pVaZ4zMhXaRIxu7K1ImOjBjsHb4PAn4vj8 9O6DKIxKmfXkyb+nXcjTBFdRa/fqN+75BzTWmGBmDPkbi2xkDZYF7IezBCDMLmnZHeN0=; Received: from [193.149.48.134] (helo=blue.greenie.muc.de) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1vNZvz-0000eC-7b for openvpn-devel@lists.sourceforge.net; Mon, 24 Nov 2025 17:01:04 +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 5AOH0u7T016065 for ; Mon, 24 Nov 2025 18:00:56 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 5AOH0ug4016064 for openvpn-devel@lists.sourceforge.net; Mon, 24 Nov 2025 18:00:56 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Mon, 24 Nov 2025 18:00:50 +0100 Message-ID: <20251124170055.16034-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.51.2 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-2.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 Throughout the function variables which deal with byte counts have a _size postfix. one_glyph is the number of bytes in one character. Reading the code is easier and more consistent this way. 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: 1vNZvz-0000eC-7b Subject: [Openvpn-devel] [PATCH v1] iservice: rename one_glyph to glyph_size 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: =?utf-8?q?1849691914866923846?= X-GMAIL-MSGID: =?utf-8?q?1849691914866923846?= From: Heiko Hund Throughout the function variables which deal with byte counts have a _size postfix. one_glyph is the number of bytes in one character. Reading the code is easier and more consistent this way. Change-Id: I69a6ab59d995fb4a511f57c8535b5ffa4048673c Signed-off-by: Heiko Hund Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1398 --- 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/+/1398 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c index 23d18aa..3d5f305 100644 --- a/src/openvpnserv/interactive.c +++ b/src/openvpnserv/interactive.c @@ -2156,14 +2156,14 @@ LSTATUS err = ERROR_FILE_NOT_FOUND; const DWORD buf_size = *size; - const size_t one_glyph = sizeof(*domains); + const size_t glyph_size = sizeof(*domains); PWSTR values[] = { L"SearchList", L"Domain", L"DhcpDomainSearchList", L"DhcpDomain", NULL }; for (int i = 0; values[i]; i++) { *size = buf_size; err = RegGetValueW(itf, NULL, values[i], RRF_RT_REG_SZ, NULL, (PBYTE)domains, size); - if (!err && *size > one_glyph && domains[(*size / one_glyph) - 1] == '\0' && wcschr(domains, '.')) + if (!err && *size > glyph_size && domains[(*size / glyph_size) - 1] == '\0' && wcschr(domains, '.')) { /* * Found domain(s), now convert them: @@ -2171,7 +2171,7 @@ * - convert comma separated list to MULTI_SZ */ PWCHAR pos = domains; - const DWORD buf_len = buf_size / one_glyph; + const DWORD buf_len = buf_size / glyph_size; while (TRUE) { /* Terminate the domain at the next comma */ @@ -2182,8 +2182,8 @@ } size_t domain_len = wcslen(pos); - size_t domain_size = domain_len * one_glyph; - size_t converted_size = (pos - domains) * one_glyph; + size_t domain_size = domain_len * glyph_size; + size_t converted_size = (pos - domains) * glyph_size; /* Ignore itf domains which match a pushed search domain */ if (ListContainsDomain(search_domains, pos, domain_len)) @@ -2192,7 +2192,7 @@ { /* Overwrite the ignored domain with remaining one(s) */ memmove(pos, comma + 1, buf_size - converted_size); - *size -= domain_size + one_glyph; + *size -= domain_size + glyph_size; continue; } else @@ -2206,31 +2206,31 @@ /* Add space for the leading dot */ domain_len += 1; - domain_size += one_glyph; + domain_size += glyph_size; /* Space for the terminating zeros */ - size_t extra_size = 2 * one_glyph; + size_t extra_size = 2 * glyph_size; /* Check for enough space to convert this domain */ if (converted_size + domain_size + extra_size > buf_size) { /* Domain doesn't fit, bad luck if it's the first one */ *pos = '\0'; - *size = converted_size == 0 ? 0 : converted_size + one_glyph; + *size = converted_size == 0 ? 0 : converted_size + glyph_size; return ERROR_MORE_DATA; } /* Prefix domain at pos with the dot */ - memmove(pos + 1, pos, buf_size - converted_size - one_glyph); + memmove(pos + 1, pos, buf_size - converted_size - glyph_size); domains[buf_len - 1] = '\0'; *pos = '.'; - *size += one_glyph; + *size += glyph_size; if (!comma) { /* Conversion is done */ *(pos + domain_len) = '\0'; - *size += one_glyph; + *size += glyph_size; return NO_ERROR; }