From: "cron2 (Code Review)" Date: Wed, 12 Nov 2025 13:38:45 +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="ybWwmwW4AzI="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: ssl: Change tls_send_payload size argument to size_t List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld , plaisthos Cc: openvpn-devel --ybWwmwW4AzI= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#2) to the change originally created by= flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1355?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by plaisthos Change subject: ssl: Change tls_send_payload size argument to size_t ...................................................................... ssl: Change tls_send_payload size argument to size_t There is only one caller of this function and it wants it to be size_t. So move the size_t to int conversion one step down in the call chain. Do not switch key_state_write_plaintext_const, yet, since that is a backend function and so needs way more work. Change-Id: Ic90c5a0e48bda4a02d5e11c4c161f388cc8805af Signed-off-by: Frank Lichtenheld Acked-by: Arne Schwabe Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1355 Message-Id: <20251111155239.31747-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34= 320.html Signed-off-by: Gert Doering --- M src/openvpn/forward.c M src/openvpn/ssl.c M src/openvpn/ssl.h 3 files changed, 10 insertions(+), 9 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/55/1355/2 diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index c355f66..aa1f858 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -365,11 +365,6 @@ } } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - bool send_control_channel_string_dowork(struct tls_session *session, const char= *str, msglvl_t msglevel) @@ -834,6 +829,11 @@ #endif /* ENABLE_MANAGEMENT */ } +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + static void check_coarse_timers(struct context *c) { diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c index 908854a..398c9ae 100644 --- a/src/openvpn/ssl.c +++ b/src/openvpn/ssl.c @@ -4032,7 +4032,7 @@ */ bool -tls_send_payload(struct key_state *ks, const uint8_t *data, int size) +tls_send_payload(struct key_state *ks, const uint8_t *data, size_t size) { bool ret =3D false; @@ -4042,7 +4042,8 @@ if (ks->state >=3D S_ACTIVE) { - if (key_state_write_plaintext_const(&ks->ks_ssl, data, size) =3D= =3D 1) + ASSERT(size <=3D INT_MAX); + if (key_state_write_plaintext_const(&ks->ks_ssl, data, (int)size) = =3D=3D 1) { ret =3D true; } @@ -4053,7 +4054,7 @@ { ks->paybuf =3D buffer_list_new(); } - buffer_list_push_data(ks->paybuf, data, (size_t)size); + buffer_list_push_data(ks->paybuf, data, size); ret =3D true; } diff --git a/src/openvpn/ssl.h b/src/openvpn/ssl.h index ffcc7c4..db8a798 100644 --- a/src/openvpn/ssl.h +++ b/src/openvpn/ssl.h @@ -426,7 +426,7 @@ /* * Send a payload over the TLS control channel */ -bool tls_send_payload(struct key_state *ks, const uint8_t *data, int size); +bool tls_send_payload(struct key_state *ks, const uint8_t *data, size_t si= ze); /* * Receive a payload through the TLS control channel -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1355?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: Ic90c5a0e48bda4a02d5e11c4c161f388cc8805af Gerrit-Change-Number: 1355 Gerrit-PatchSet: 2 Gerrit-Owner: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel --ybWwmwW4AzI= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

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

View Change

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

ssl: Change tls_send_payload si=
ze argument to size_t

There is only one caller of this function and = it
wants it to be size_t. So move the size_t to int
conversion one st= ep down in the call chain. Do not
switch key_state_write_plaintext_const= , yet, since
that is a backend function and so needs way more
work.
Change-Id: Ic90c5a0e48bda4a02d5e11c4c161f388cc8805af
Signed-off-by= : Frank Lichtenheld <frank@...2641...>
Acked-by: Arne Schwabe <= arne-openvpn@...1227...>
Gerrit URL: https://gerrit.openvpn.net/c/ope= nvpn/+/1355
Message-Id: <20251111155239.31747-1-gert@...1296...>URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg= 34320.html
Signed-off-by: Gert Doering <gert@...1296...>
---M src/openvpn/forward.c
M src/openvpn/ssl.c
M src/openvpn/ssl.h
3= files changed, 10 insertions(+), 9 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/55/1355/2
<=
span>diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
<= span>index c355f66..aa1f858 100644
--- a/src/openvpn/forwar= d.c
+++ b/src/openvpn/forward.c
@@ -365,11 = +365,6 @@
}
}

-#if defined(__GNUC__) || de= fined(__clang__)
-#prag= ma GCC diagnostic push
= -#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
bool
send_control_ch= annel_string_dowork(struct tls_session *session, const char *str, msglvl_t msglevel)
@@ -834,6 +829,11 @@

#endif /* ENABLE_MANAGEMENT */
}

+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push+#pragma GCC diagnostic ignore= d "-Wconversion"
+#endif
+
static void
check_coarse_timers(struct context= *c)
{
diff --git a/src/openvpn/ssl.c b/sr= c/openvpn/ssl.c
index 908854a..398c9ae 100644
--- a/src/openvpn/ssl.c

+++ b/src/openvpn/ssl.c@@ -4032,7 +4032,7 @@
*/
=
bool
-tls_se= nd_payload(struct key_state *ks, const uint8_t *data, int size)
<= span style=3D"color: hsl(120, 100%, 40%);">+tls_send_payload(struct key_sta= te *ks, const uint8_t *data, size_t size)

{
bool ret =3D false;

@@ -4042,7 +40= 42,8 @@

if (ks->state >=3D S_A= CTIVE)
{
- if (key_state_write_plaintext_const(&ks->ks_ssl, dat= a, size) =3D=3D 1)
+ = ASSERT(size <=3D INT_MAX);
+ if (key_state_write_plaintext_const(&ks->ks= _ssl, data, (int)size) =3D=3D 1)
{
ret =3D true;
}
@@ -= 4053,7 +4054,7 @@
{
k= s->paybuf =3D buffer_list_new();
}
- buffer_list_push_data(ks-&= gt;paybuf, data, (size_t)size);
+ buffer_list_push_data(ks->paybuf, data, size);

ret =3D true;
}
<= /span>
diff --git a/src/openvpn/ssl.h b/src/openvpn/ssl.hindex ffcc7c4..db8a798 100644
--- a/src/openvpn/ssl= .h
+++ b/src/openvpn/ssl.h
@@ -426,7 +426,7= @@
/*
* Send a payload over the TLS con= trol channel
*/
-bool tls_send_payload(struct key_state *ks, const uint8_t *data= , int size);
+bool tl= s_send_payload(struct key_state *ks, const uint8_t *data, size_t size);

/*
* Receive a payload th= rough the TLS control channel

To view, = visit ch= ange 1355. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ic90c5a0e48bda4a02d5e11c4c16= 1f388cc8805af
Gerrit-Change-Number: 1355
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --ybWwmwW4AzI=--