From: "flichtenheld (Code Review)" Date: Wed, 21 Jan 2026 17:15:58 +0000 In-Reply-To: References: Reply-To: frank@...2641..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, gert@...1296... Message-ID: <6c7d060bfdef00cea726bb8bef10ab815567b925-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="Kuel6SRM3bA="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: push: Fix conversion issues related to timeout in send_auth_pending_m... List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: openvpn-devel --Kuel6SRM3bA= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: cron2, flichtenheld. Hello cron2, plaisthos, I'd like you to reexamine a change. Please visit http://gerrit.openvpn.net/c/openvpn/+/1293?usp=3Demail to look at the new patch set (#10). The following approvals got outdated and were removed: Code-Review-1 by cron2 Change subject: push: Fix conversion issues related to timeout in send_auth= _pending_messages ...................................................................... push: Fix conversion issues related to timeout in send_auth_pending_messages Add additional checking to make sure that the required casts are safe. Change-Id: Icc31b7fa0da86220df45552aecc15dc6c769cd54 Signed-off-by: Frank Lichtenheld --- M src/openvpn/push.c M src/openvpn/ssl_verify.c 2 files changed, 13 insertions(+), 7 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/93/1293/10 diff --git a/src/openvpn/push.c b/src/openvpn/push.c index 25df48d..551a5c7 100644 --- a/src/openvpn/push.c +++ b/src/openvpn/push.c @@ -429,11 +429,6 @@ gc_free(&gc); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - bool send_auth_pending_messages(struct tls_multi *tls_multi, struct tls_session= *session, const char *extra, unsigned int timeout) @@ -449,7 +444,12 @@ /* Calculate the maximum timeout and subtract the time we already wait= ed */ unsigned int max_timeout =3D max_uint(tls_multi->opt.renegotiate_seconds / 2, tls_multi->opt.ha= ndshake_window); - max_timeout =3D max_timeout - (now - ks->initial); + time_t time_elapsed =3D now - ks->initial; + if (time_elapsed < 0 || time_elapsed >=3D (time_t)max_timeout) + { + return false; + } + max_timeout -=3D (unsigned int)time_elapsed; timeout =3D min_uint(max_timeout, timeout); struct gc_arena gc =3D gc_new(); @@ -738,6 +738,11 @@ return true; } +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + static bool send_push_options(struct context *c, struct buffer *buf, struct push_list = *push_list, int safe_cap, bool *push_sent, bool *multi_push) diff --git a/src/openvpn/ssl_verify.c b/src/openvpn/ssl_verify.c index 0b02a2f..c74d555 100644 --- a/src/openvpn/ssl_verify.c +++ b/src/openvpn/ssl_verify.c @@ -911,8 +911,9 @@ buf_chomp(iv_buf); buf_chomp(extra_buf); + errno =3D 0; long timeout =3D strtol(BSTR(timeout_buf), NULL, 10); - if (timeout <=3D 0) + if (timeout <=3D 0 || timeout > UINT_MAX || errno) { msg(M_WARN, "could not parse auth pending file timeout"); buffer_list_free(lines); -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1293?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: Icc31b7fa0da86220df45552aecc15dc6c769cd54 Gerrit-Change-Number: 1293 Gerrit-PatchSet: 10 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: cron2 Gerrit-Attention: flichtenheld --Kuel6SRM3bA= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is cur= rently required from: cron2, flichtenheld.

flichtenheld uploaded patch set #10 to this change.

=

View = Change

The following approvals got outdated and were removed: Code-Review-1 by cron2

push: Fix conversion issues related=
 to timeout in send_auth_pending_messages

Add additional checking to= make sure that the required
casts are safe.

Change-Id: Icc31b7fa= 0da86220df45552aecc15dc6c769cd54
Signed-off-by: Frank Lichtenheld <fr= ank@...2641...>
---
M src/openvpn/push.c
M src/openvpn/ssl_veri= fy.c
2 files changed, 13 insertions(+), 7 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/93/1= 293/10
diff --git a/src/openvpn/push.c b/src/openvpn/push.c<=
br>index 25df48d..551a5c7 100644
--- a/src/openvpn/pu= sh.c
+++ b/src/openvpn/push.c
@@ -429,11 +4= 29,6 @@
gc_free(&gc);
}
-#if defined(_= _GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
bool
s= end_auth_pending_messages(struct tls_multi *tls_multi, struct tls_session *= session,
const char *extra, uns= igned int timeout)
@@ -449,7 +444,12 @@
= /* Calculate the maximum timeout and subtract the time we already waited = */
unsigned int max_timeout =3D
= max_uint(tls_multi->opt.renegotiate_seconds / 2, tls_multi->opt.ha= ndshake_window);
- m= ax_timeout =3D max_timeout - (now - ks->initial);
+ time_t time_elapsed =3D now - ks->= initial;
+ if (tim= e_elapsed < 0 || time_elapsed >=3D (time_t)max_timeout)
+ {

+ return false;
+ }
+ max_timeout -=3D (unsigned int)time_elapsed;
= timeout =3D min_uint(max_timeout, timeout);

struct gc_arena gc =3D gc_new();
@@ -738= ,6 +738,11 @@
return true;
}
+#if define= d(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wconversion&quo= t;
+#endif
= +
static bool<= /span>
send_push_options(struct context *c, struct buffer *buf, s= truct push_list *push_list, int safe_cap,
= bool *push_sent, bool *multi_push)
diff --git a/src/openv= pn/ssl_verify.c b/src/openvpn/ssl_verify.c
index 0b02a2f..c= 74d555 100644
--- a/src/openvpn/ssl_verify.c
+++ b/src/openvpn/ssl_verify.c

@@ -911,8 +911,9 @@=
buf_chomp(iv_buf);
buf_= chomp(extra_buf);

+ errno =3D 0;
long = timeout =3D strtol(BSTR(timeout_buf), NULL, 10);
- if (timeout <=3D 0)
+ if (timeout <=3D 0= || timeout > UINT_MAX || errno)

{ msg(M_WARN, "could not parse auth pending fil= e timeout");
buffer_list_free(lines);=

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

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icc31b7fa0da86220df45552aecc= 15dc6c769cd54
Gerrit-Change-Number: 1293
Gerrit-PatchSet: 10
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>
Gerrit-Attention: cron2 <gert@...1296...>= ;
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
= --Kuel6SRM3bA=--