Skip to contentSkip to conversation

Change in openvpn[master]: ssl: Fix -Wconversion warnings in pem_password_callback

Openvpn-devel In review flichtenheld (Code Review) 2 participants 6 messages Aug 6, 2025 – Sep 23, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1754490554000.I053ddbb71cc5b9ae16c5a49be833035d943d7eba@...2715...

#1 lore raw

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/+/1137?usp=email

to review the following change.

Change subject: ssl: Fix -Wconversion warnings in pem_password_callback
......................................................................

ssl: Fix -Wconversion warnings in pem_password_callback

The OpenSSL API is how it is, so adapt with casts.

Change-Id I053ddbb71cc5b9ae16c5a49be833035d943d7eba

---
M src/openvpn/ssl.c

1 file changed, 2 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/37/1137/1

src/openvpn/ssl.c +2 -2
index 17065aa..d586ba1 100644
@@ -264,10 +264,10 @@
         /* prompt for password even if --askpass wasn't specified */
         pem_password_setup(NULL);
         ASSERT(!passbuf.protected);
-        strncpynt(buf, passbuf.password, size);
+        strncpynt(buf, passbuf.password, (size_t)size);
         purge_user_pass(&passbuf, false);
 
-        return strlen(buf);
+        return (int)strlen(buf);
     }
     return 0;
 }

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1137?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I053ddbb71cc5b9ae16c5a49be833035d943d7eba
Gerrit-Change-Number: 1137
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/1137?usp=email )

Change subject: ssl: Fix -Wconversion warnings in pem_password_callback
......................................................................

Patch Set 9: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1137?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I053ddbb71cc5b9ae16c5a49be833035d943d7eba
Gerrit-Change-Number: 1137
Gerrit-PatchSet: 9
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Mon, 22 Sep 2025 20:41:42 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#3 lore raw

PATCH v9 1/1 ssl: Fix -Wconversion warnings in pem_password_callback

In reply to a message not in the archive

From: Frank Lichtenheld <[email protected]...>

The OpenSSL API is how it is, so adapt with casts.

Change-Id I053ddbb71cc5b9ae16c5a49be833035d943d7eba

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1137
---

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/+/1137
This mail reflects revision 9 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

src/openvpn/ssl.c +2 -2
index c17e608..284d951 100644
@@ -264,10 +264,10 @@
         /* prompt for password even if --askpass wasn't specified */
         pem_password_setup(NULL);
         ASSERT(!passbuf.protected);
-        strncpynt(buf, passbuf.password, size);
+        strncpynt(buf, passbuf.password, (size_t)size);
         purge_user_pass(&passbuf, false);
 
-        return strlen(buf);
+        return (int)strlen(buf);
     }
     return 0;
 }
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: ssl: Fix -Wconversion warnings in pem_password_callback

Straightforward & does not break anything :-) (tested in a local build with a profile with an encrypted private key)

Your patch has been applied to the master branch.

commit e256d668d6356cdb379bf7ceca1617ed7925d28e

Author: Frank Lichtenheld
Date:   Mon Sep 22 22:41:52 2025 +0200
     ssl: Fix -Wconversion warnings in pem_password_callback

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1137
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg33154.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#5 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#10) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1137?usp=email )

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

Change subject: ssl: Fix -Wconversion warnings in pem_password_callback
......................................................................

ssl: Fix -Wconversion warnings in pem_password_callback

The OpenSSL API is how it is, so adapt with casts.

Change-Id I053ddbb71cc5b9ae16c5a49be833035d943d7eba

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1137
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg33154.html

---
M src/openvpn/ssl.c

1 file changed, 2 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/37/1137/10

src/openvpn/ssl.c +2 -2
index 9159b8c..ba6919b 100644
@@ -264,10 +264,10 @@
         /* prompt for password even if --askpass wasn't specified */
         pem_password_setup(NULL);
         ASSERT(!passbuf.protected);
-        strncpynt(buf, passbuf.password, size);
+        strncpynt(buf, passbuf.password, (size_t)size);
         purge_user_pass(&passbuf, false);
 
-        return strlen(buf);
+        return (int)strlen(buf);
     }
     return 0;
 }

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1137?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I053ddbb71cc5b9ae16c5a49be833035d943d7eba
Gerrit-Change-Number: 1137
Gerrit-PatchSet: 10
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset

#6 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1137?usp=email )

Change subject: ssl: Fix -Wconversion warnings in pem_password_callback
......................................................................

ssl: Fix -Wconversion warnings in pem_password_callback

The OpenSSL API is how it is, so adapt with casts.

Change-Id I053ddbb71cc5b9ae16c5a49be833035d943d7eba

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1137
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg33154.html

---
M src/openvpn/ssl.c

1 file changed, 2 insertions(+), 2 deletions(-)
src/openvpn/ssl.c +2 -2
index 9159b8c..ba6919b 100644
@@ -264,10 +264,10 @@
         /* prompt for password even if --askpass wasn't specified */
         pem_password_setup(NULL);
         ASSERT(!passbuf.protected);
-        strncpynt(buf, passbuf.password, size);
+        strncpynt(buf, passbuf.password, (size_t)size);
         purge_user_pass(&passbuf, false);
 
-        return strlen(buf);
+        return (int)strlen(buf);
     }
     return 0;
 }

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1137?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I053ddbb71cc5b9ae16c5a49be833035d943d7eba
Gerrit-Change-Number: 1137
Gerrit-PatchSet: 10
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged