From: "cron2 (Code Review)" Date: Mon, 17 Nov 2025 07:59:56 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="J/5d5qHzCe0="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: ssl: Clean up type handling in parse_early_negotiation_tlvs() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld Cc: plaisthos , openvpn-devel --J/5d5qHzCe0= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/13= 02?usp=3Demail ) Change subject: ssl: Clean up type handling in parse_early_negotiation_tlvs= () ...................................................................... ssl: Clean up type handling in parse_early_negotiation_tlvs() buf_read_u16 does not return uint16_t. Change-Id: Ie7ad637223c332f7611c09b20a8d7a3a92d97ec7 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1302 Message-Id: <20251116215433.29257-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34= 487.html Signed-off-by: Gert Doering --- M src/openvpn/ssl.c 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c index 4841837..8501693 100644 --- a/src/openvpn/ssl.c +++ b/src/openvpn/ssl.c @@ -2194,11 +2194,6 @@ } } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - /** * Handle reading key data, peer-info, username/password, OCC * from the TLS control channel (cleartext). @@ -2522,9 +2517,9 @@ goto error; } /* read type */ - uint16_t type =3D buf_read_u16(buf); - uint16_t len =3D buf_read_u16(buf); - if (buf_len(buf) < len) + int type =3D buf_read_u16(buf); + int len =3D buf_read_u16(buf); + if (type < 0 || len < 0 || buf_len(buf) < len) { goto error; } @@ -2536,7 +2531,7 @@ { goto error; } - uint16_t flags =3D buf_read_u16(buf); + int flags =3D buf_read_u16(buf); if (flags & EARLY_NEG_FLAG_RESEND_WKC) { @@ -3963,10 +3958,6 @@ } } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - void tls_prepend_opcode_v1(const struct tls_multi *multi, struct buffer *buf) { -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1302?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: merged Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ie7ad637223c332f7611c09b20a8d7a3a92d97ec7 Gerrit-Change-Number: 1302 Gerrit-PatchSet: 7 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel --J/5d5qHzCe0= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 sub= mitted this change.

View Change

ssl: Clean up type handling in parse_early_negot=
iation_tlvs()

buf_read_u16 does not return uint16_t.

Change-I= d: Ie7ad637223c332f7611c09b20a8d7a3a92d97ec7
Signed-off-by: Frank Lichte= nheld <frank@...2641...>
Acked-by: Gert Doering <gert@...2132...= .>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1302
Message= -Id: <20251116215433.29257-1-gert@...1296...>
URL: https://www.mai= l-archive.com/openvpn-devel@lists.sourceforge.net/msg34487.html
Signed-o= ff-by: Gert Doering <gert@...1296...>
---
M src/openvpn/ssl.c1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c
index= 4841837..8501693 100644
--- a/src/openvpn/ssl.c
= +++ b/src/openvpn/ssl.c
@@ -2194,11 +2194,6 @@=
}
}

-#if defined(__GNUC__) || defined(__clang__)=
-#pragma GCC diagnosti= c push
-#pragma GCC dia= gnostic ignored "-Wconversion"
-#endif
-
/**
* Handle reading key data, peer= -info, username/password, OCC
* from the TLS control chan= nel (cleartext).
@@ -2522,9 +2517,9 @@
= goto error;
}
/*= read type */
- = uint16_t type =3D buf_read_u16(buf);
- uint16_t len =3D buf_read_u16(buf);
- if (buf_len(buf) < len)

+ int type =3D bu= f_read_u16(buf);
+ = int len =3D buf_read_u16(buf);
+ if (type < 0 || len < 0 || buf_len(buf) < = len)
{
goto error;
}
@@ -2536,7 +2531,7 @@
{

goto error;
}
- uint16_t flags =3D buf_read_u16(buf);
<= span style=3D"color: hsl(120, 100%, 40%);">+ int flags =3D b= uf_read_u16(buf);


if (fl= ags & EARLY_NEG_FLAG_RESEND_WKC)
{
@@ -3963,10 +3958,6 @@
}
= }

-#= if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
void
tls_prepend_opcode_v1(co= nst struct tls_multi *multi, struct buffer *buf)
{<= br>

To view, visit change 1302. To unsubscribe, or for= help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie7ad637223c332f7611c09b20a8= d7a3a92d97ec7
Gerrit-Change-Number: 1302
Gerrit-PatchSet: 7
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>
= --J/5d5qHzCe0=--