From 4699e90e995575d7946b8e95df4c78151f08d41a Mon Sep 17 00:00:00 2001 From: "Deomid \"rojer\" Ryabkov" Date: Fri, 5 Feb 2021 15:32:38 +0000 Subject: [PATCH] Ensure struct mg_connect_opts size remains the same, SSL or not It is passed by value so libraries compiled with and without SSL cannot interoperate if struct size is different. --- mongoose.h | 9 +++++++++ src/mg_net.h | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/mongoose.h b/mongoose.h index a6e23b86..0491e1b9 100644 --- a/mongoose.h +++ b/mongoose.h @@ -3871,6 +3871,15 @@ struct mg_connect_opts { */ const char *ssl_psk_identity; const char *ssl_psk_key; +#else + /* Ensure struct size remains the same. */ + const char *unused_ssl_cert; + const char *unused_ssl_key; + const char *unused_ssl_ca_cert; + const char *unused_ssl_cipher_suites; + const char *unused_ssl_server_name; + const char *unused_ssl_psk_identity; + const char *unused_ssl_psk_key; #endif }; diff --git a/src/mg_net.h b/src/mg_net.h index 89939bf2..d55ea6b3 100644 --- a/src/mg_net.h +++ b/src/mg_net.h @@ -393,6 +393,15 @@ struct mg_connect_opts { */ const char *ssl_psk_identity; const char *ssl_psk_key; +#else + /* Ensure struct size remains the same. */ + const char *unused_ssl_cert; + const char *unused_ssl_key; + const char *unused_ssl_ca_cert; + const char *unused_ssl_cipher_suites; + const char *unused_ssl_server_name; + const char *unused_ssl_psk_identity; + const char *unused_ssl_psk_key; #endif };