[Openvpn-devel,v1] ssl: fix MSVC C4047 in key_method_2_read()

Message ID 20261119212622.5852-1-gert@greenie.muc.de
State New
Headers
Series [Openvpn-devel,v1] ssl: fix MSVC C4047 in key_method_2_read() |

Commit Message

Gert Doering Nov. 19, 2026, 9:26 p.m. UTC
  From: Razvan Cojocaru <razvanc@mailbox.org>

Assigning strstr()'s result to the bool remote_usescomp warns under
MSVC and fails the /WX build. Compare against NULL.

Change-Id: I9a78e57cff805e1896d79a17fbcd4132c5a4b1b3
Signed-off-by: Razvan Cojocaru <razvanc@mailbox.org>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2220
---

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

Acked-by according to Gerrit (reflected above):
Lev Stipakov <lstipakov@gmail.com>
  

Patch

diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c
index e06659a..d5ae13d 100644
--- a/src/openvpn/ssl.c
+++ b/src/openvpn/ssl.c
@@ -2409,7 +2409,7 @@ 
 
     free(multi->remote_ciphername);
     multi->remote_ciphername = options_string_extract_option(options, "cipher", NULL);
-    multi->remote_usescomp = strstr(options, ",comp-lzo,");
+    multi->remote_usescomp = (strstr(options, ",comp-lzo,") != NULL);
 
     /* In OCC we send '[null-cipher]' instead 'none' */
     if (multi->remote_ciphername && strcmp(multi->remote_ciphername, "[null-cipher]") == 0)