[Openvpn-devel,v1] crypto: Add more explicit casts for OpenBSD

Message ID 20251006170403.7128-1-gert@greenie.muc.de
State New
Headers show
Series [Openvpn-devel,v1] crypto: Add more explicit casts for OpenBSD | expand

Commit Message

Gert Doering Oct. 6, 2025, 5:03 p.m. UTC
From: Frank Lichtenheld <frank@lichtenheld.com>

The compiler on OpenBSD is a bit more zealous
about these strlen's even though these are
static values that can be determined at
compile time...

This was missed in the previous commit
("crypto: Make some casts to int explicit")
because we don't use -Werror on OpenBSD, yet.

Change-Id: Ia93bd8874e1b578d553720eedc274b974a462483
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1252
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1252
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <gert@greenie.muc.de>

Patch

diff --git a/src/openvpn/crypto.c b/src/openvpn/crypto.c
index 13635fb..026e874 100644
--- a/src/openvpn/crypto.c
+++ b/src/openvpn/crypto.c
@@ -1361,8 +1361,8 @@ 
     int state = PARSE_INITIAL;
 
     /* constants */
-    const int hlen = strlen(static_key_head);
-    const int flen = strlen(static_key_foot);
+    const int hlen = (int)strlen(static_key_head);
+    const int flen = (int)strlen(static_key_foot);
     const int onekeylen = sizeof(key2->keys[0]);
 
     CLEAR(*key2);