From: "flichtenheld (Code Review)" Date: Fri, 24 Oct 2025 16:52:53 +0000 References: Reply-To: frank@...2641..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: <40e3384c8df52fc80c1750b0f07ed932beb700e9-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="TAMT6+7GM7g="; 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: plaisthos Cc: openvpn-devel --TAMT6+7GM7g= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: plaisthos. Hello plaisthos, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/1302?usp=3Demail to review the following change. 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 --- M src/openvpn/ssl.c 1 file changed, 4 insertions(+), 13 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/02/1302/1 diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c index 819a1ef..9a3ba88 100644 --- a/src/openvpn/ssl.c +++ b/src/openvpn/ssl.c @@ -2195,11 +2195,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). @@ -2530,9 +2525,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; } @@ -2544,7 +2539,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) { @@ -3975,10 +3970,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: newchange Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ie7ad637223c332f7611c09b20a8d7a3a92d97ec7 Gerrit-Change-Number: 1302 Gerrit-PatchSet: 1 Gerrit-Owner: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos --TAMT6+7GM7g= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is cur= rently required from: plaisthos.

flichtenheld would like plaisthos to review this change.

V= iew Change

ssl: Clean up type handling in parse_early_=
negotiation_tlvs()

buf_read_u16 does not return uint16_t.

Cha= nge-Id: Ie7ad637223c332f7611c09b20a8d7a3a92d97ec7
Signed-off-by: Frank L= ichtenheld <frank@...2641...>
---
M src/openvpn/ssl.c
1 file= changed, 4 insertions(+), 13 deletions(-)

git p=
ull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/02/1302/1
d= iff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c
index 819= a1ef..9a3ba88 100644
--- a/src/openvpn/ssl.c
+++ b/src/openvpn/ssl.c
@@ -2195,11 +2195,6 @@
= }
}

-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pu= sh
-#pragma GCC diagnos= tic ignored "-Wconversion"
-#endif
-=
/**
* Handle reading key data, peer-inf= o, username/password, OCC
* from the TLS control channel = (cleartext).
@@ -2530,9 +2525,9 @@
= goto error;
}
/* rea= d type */
- uint= 16_t type =3D buf_read_u16(buf);
- uint16_t len =3D buf_read_u16(buf);
- if (buf_len(buf) < len)<= br>+ int type =3D buf_re= ad_u16(buf);
+ = int len =3D buf_read_u16(buf);
+ if (type < 0 || len < 0 || buf_len(buf) < len)=
{
goto error;=
}
@@ -2544,7 +2539,7 @@
= {
goto error;<= br> }
- uint16_t flags =3D buf_read_u16(buf);
+ int flags =3D buf_r= ead_u16(buf);


if (flags = & EARLY_NEG_FLAG_RESEND_WKC)
{<= br>@@ -3975,10 +3970,6 @@
}
}

-#if d= efined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
void
tls_prepend_opcode_v1(const = struct tls_multi *multi, struct buffer *buf)
{
<= span>

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

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie7ad637223c332f7611c09b20a8= d7a3a92d97ec7
Gerrit-Change-Number: 1302
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
= --TAMT6+7GM7g=--