From patchwork Wed Mar 4 10:50:01 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4792 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7001:a68f:b0:83c:d90d:321 with SMTP id wf15csp132468mab; Wed, 4 Mar 2026 02:50:35 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVW0T+PA+h01SGxHoyjuCCayaAF6KY7XXO/rq5gspcnMkS6PnjoGdDpzfIxHWqFMdGS6xRa4EuU2Zg=@openvpn.net X-Received: by 2002:a05:6808:344b:b0:45e:e15e:4ab2 with SMTP id 5614622812f47-4651ad1d690mr883610b6e.45.1772621435754; Wed, 04 Mar 2026 02:50:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1772621435; cv=none; d=google.com; s=arc-20240605; b=Y5HWWBpWnHE83sUe3+C2rKMu1MduZoPZvPHy5tAmW1DeUnL4GPMzDzDAWHhy0TqbxC ZjwxPSDBQP3NfGdrqsIf/WDBRKTfYA30atFHeSeRR2ZYegYXEyvdPvTGUyOnOo3vuqea NZCRqsfE420ub0q80zx9jelNFN7Ejnzob0mvTF9nEbr8AR8poVAcEXhyrZAU+q8RJGv4 8LPOi345DmlMrHxxaRTfTyu1SzGDFaTa1hr2JZF6cx8dON3XbmFoSx2kI/mQop/W2b1g CFBRNGJWwB0gZhB91pAu1TgWmtxhguLYgoqNPPXFmMeqVtuuMrzgKNgZSd+c0m/CkFti 0IDg== 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=Jj/F6Ctz7kJoUIDAIQyB3bqboLYRKam0IyebQ/30RBs=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=VVNhWaDx+g2Pl61KxwHKfWO/vC/nHADR5AJwdVaazTBVA+r2xk6okvVdJbR0K0v26Q GGWhSgSoNZS6UuIIsX+ooKGA4f9oD2UjvLN5ytr8kzVJPg9lA1Rb5ydsfw5d+vMVfCBl pG/CPXu2xnynkEPpqBUuU4CBAAcGPM/B1E5VLQ3m6iO2fQU8ri2db8ffoSMiwXLIo+8D PvYQZ+am85PzX8wbislstyFcBevQTfFnrLKVZe7Wjpvn9Fx3reu1dT4xv6kUOAPEOPri ArVNJcr3XY5cmyTRuBIjsyhtyuh8yqSSXcx/o01f+rSs/TX5wOxUkKiq9zFUp4pEMtY+ EkSw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=VtEybg6F; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=NNQwul8T; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=f3eXn8Oq; 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 586e51a60fabf-4160cf39721si13444936fac.9.2026.03.04.02.50.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Mar 2026 02:50:35 -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=VtEybg6F; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=NNQwul8T; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=f3eXn8Oq; 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=Jj/F6Ctz7kJoUIDAIQyB3bqboLYRKam0IyebQ/30RBs=; b=VtEybg6FMOT7PQy6t1VsuS7/Ht O9lIEHvgrLsrC/Bsw00mW5Xzpqo2S6PBajvu0t0IY/MM5qzaaWM0JsZtxc758Xnt0UwRMC+0yePgq 2IKro3OdILKlujkipXh5IlSG1yRi2o3JsJdyyUXZbH+5uWTO5O04HPWiFXUXaPReaY6Q=; 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 1vxjoH-00024L-3W; Wed, 04 Mar 2026 10:50:33 +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 1vxjoC-000245-Qx for openvpn-devel@lists.sourceforge.net; Wed, 04 Mar 2026 10:50:29 +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=zvbY9zCnwhRJC0XBYYMrVSJu17bA0alR3A997aurkVE=; b=NNQwul8TWRAR87x22i93fusdzC B6MZa2hDolvmAJ4QFLRPw9BpqlGdzMzDJ5i/NPsyaNLrS8tXYrnhJTrGWEQFmj2pz+cKECTgQkLEp inNXSjCyyg0Dd/ouZyqhUys/oLWXdZSeC9GUkFDz4ilB3Epsh3HNNtvtQUOBdBDWClMU=; 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=zvbY9zCnwhRJC0XBYYMrVSJu17bA0alR3A997aurkVE=; b=f3eXn8OqFVcJRwirSusJWkwUfz ktB4cQ44/TIYxaWxUdAl5YPFlr1xyOIYSotjG5o6UCfy+SLT4qGw4dLAf/ah9JZP/aRLeOfe5rDVY GfBeAqc7DofVWAyzRJsa53dbXhMSUOSnVVWNYRV9BLP8Sq93dFKQGA+w2R7RTNwVtD5M=; Received: from [193.149.48.129] (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 1vxjo5-00032z-1C for openvpn-devel@lists.sourceforge.net; Wed, 04 Mar 2026 10:50:22 +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 624Ao70i014500 for ; Wed, 4 Mar 2026 11:50:07 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 624Ao7Mk014499 for openvpn-devel@lists.sourceforge.net; Wed, 4 Mar 2026 11:50:07 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Wed, 4 Mar 2026 11:50:01 +0100 Message-ID: <20260304105007.14485-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.52.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: Frank Lichtenheld Silence compiler warnings due to conversion from char to unsigned char. In this case we actually depend on this conversion. Change-Id: I73bc163d48b2d6a954cd231961826f33143fcd12 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/open [...] 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: 1vxjo5-00032z-1C Subject: [Openvpn-devel] [PATCH v7] buffer: Clarify usage of char_class 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?1858728294421533011?= X-GMAIL-MSGID: =?utf-8?q?1858728294421533011?= From: Frank Lichtenheld Silence compiler warnings due to conversion from char to unsigned char. In this case we actually depend on this conversion. Change-Id: I73bc163d48b2d6a954cd231961826f33143fcd12 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1142 --- 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/+/1142 This mail reflects revision 7 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering diff --git a/src/openvpn/buffer.c b/src/openvpn/buffer.c index dd74b38..12a8ff9 100644 --- a/src/openvpn/buffer.c +++ b/src/openvpn/buffer.c @@ -559,7 +559,7 @@ { break; } - if (char_class(*last, CC_CRLF | CC_NULL)) + if (char_class((unsigned char)*last, CC_CRLF | CC_NULL)) { if (!buf_inc_len(buf, -1)) { @@ -876,6 +876,14 @@ * Classify and mutate strings based on character types. */ +/* Note 1: This functions depends on getting an unsigned + char. Both the is*() functions and our own checks expect it + this way. + Note 2: For CC_PRINT we just accept everything >= 32, so + if we ingest non-ASCII UTF-8 we will classify it as + printable since it will be >= 128. Other encodings are + not officially supported. +*/ bool char_class(const unsigned char c, const unsigned int flags) { @@ -1019,7 +1027,8 @@ static inline bool char_inc_exc(const char c, const unsigned int inclusive, const unsigned int exclusive) { - return char_class(c, inclusive) && !char_class(c, exclusive); + return char_class((unsigned char)c, inclusive) + && !char_class((unsigned char)c, exclusive); } bool