From: "cron2 (Code Review)" Date: Wed, 4 Mar 2026 11:58:43 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <899335e308c1670e5a36d03a8b276e5baed23d3b-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="AeTHmllScLE="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: buffer: Clarify usage of char_class List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld , plaisthos Cc: openvpn-devel --AeTHmllScLE= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#8) to the change originally created by= flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1142?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by cron2 Change subject: buffer: Clarify usage of char_class ...................................................................... buffer: Clarify usage of char_class 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 Message-Id: <20260304105007.14485-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35= 867.html Signed-off-by: Gert Doering --- M src/openvpn/buffer.c 1 file changed, 11 insertions(+), 2 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/42/1142/8 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 >=3D 32, so + if we ingest non-ASCII UTF-8 we will classify it as + printable since it will be >=3D 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 in= t exclusive) { - return char_class(c, inclusive) && !char_class(c, exclusive); + return char_class((unsigned char)c, inclusive) + && !char_class((unsigned char)c, exclusive); } bool -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1142?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newpatchset Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I73bc163d48b2d6a954cd231961826f33143fcd12 Gerrit-Change-Number: 1142 Gerrit-PatchSet: 8 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel --AeTHmllScLE= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 upl= oaded patch set #8 to the change originally created by flichtenhel= d.

View Change

The following approvals got outdated and were remove= d: Code-Review+2 by cron2

buffer: Clarify usage of char_class=


Silence compiler warnings due to conversion from
char to unsigne= d char. In this case we actually
depend on this conversion.

Chang= e-Id: I73bc163d48b2d6a954cd231961826f33143fcd12
Signed-off-by: Frank Lic= htenheld <frank@...2641...>
Acked-by: Gert Doering <gert@...1826...= 6...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1142
Mess= age-Id: <20260304105007.14485-1-gert@...1296...>
URL: https://www.= mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35867.html
Signe= d-off-by: Gert Doering <gert@...1296...>
---
M src/openvpn/buff= er.c
1 file changed, 11 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/42/11=
42/8
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 depe= nds 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 >=3D 32, so

+ if we ingest non-ASCII UTF-8 we will classify it as<= br>+ printable since it will = be >=3D 128. Other encodings are
+ not officially supported.
+*/
bool
char_cla= ss(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_c= lass(c, exclusive);
+= return char_class((unsigned char)c, inclusive)
+ && !char_class((unsigned = char)c, exclusive);
}

b= ool

To view, visit change 1142. To unsubscr= ibe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I73bc163d48b2d6a954cd2319618= 26f33143fcd12
Gerrit-Change-Number: 1142
Gerrit-PatchSet: 8
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --AeTHmllScLE=--