Skip to contentSkip to conversation

Fix plugin_call() struct env_set corruption

PATCH In review David Sommerseth 2 participants 2 messages Oct 23, 2011 – Nov 7, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix plugin_call() struct env_set corruption

For some odd reasons, the static inline plugin_call() function managed to corrupt the struct env_set *es pointer. The result was that es->list pointed at an invalid address, which again caused SEGV.

This patch replaces the static inline function with a macro instead, and let the plugin_call_ssl() keep all its arguments - no matter if SSL is enabled or not.

This issues appeared first in commit 1876ccd012e9e2ca6f8e1cd9e7e9bb4bf24ccecb, which does modify the plugin system.

---
 plugin.c |    5 +----
 plugin.h |   21 +++------------------
 2 files changed, 4 insertions(+), 22 deletions(-)
plugin.c +1 -4
index 737a868..2fdf0d4 100644
@@ -584,11 +584,8 @@ plugin_call_ssl (const struct plugin_list *pl,
 	     const int type,
 	     const struct argv *av,
 	     struct plugin_return *pr,
-	     struct env_set *es
-#ifdef USE_SSL
-             , int certdepth,
+	     struct env_set *es, int certdepth,
 	     x509_cert_t *current_cert
-#endif
 	    )
 {
   if (pr)
plugin.h +3 -18
index 8782751..2ad8883 100644
@@ -122,30 +122,15 @@ void plugin_list_open (struct plugin_list *pl,
 
 struct plugin_list *plugin_list_inherit (const struct plugin_list *src);
 
-
-static inline int
-plugin_call(const struct plugin_list *pl,
-	const int type,
-	const struct argv *av,
-	struct plugin_return *pr,
-	struct env_set *es)
-{
-  return plugin_call_ssl(pl, type, av, pr, es
-#ifdef USE_SSL
-      -1, NULL
-#endif
-      );
-}
+/** Wrapper for function calls not needing to pass SSL certificate information */
+#define plugin_call(pl, type, av, pr, es) plugin_call_ssl(pl, type, av, pr, es, -1, NULL)
 
 int plugin_call_ssl (const struct plugin_list *pl,
 		 const int type,
 		 const struct argv *av,
 		 struct plugin_return *pr,
-		 struct env_set *es
-#ifdef USE_SSL
-		 , int current_cert_depth,
+		 struct env_set *es, int current_cert_depth,
 		 x509_cert_t *current_cert
-#endif
 		);
 
 void plugin_list_close (struct plugin_list *pl);
Signature · 1 line
1.7.4.4
#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 8 lines · David Sommerseth

For some odd reasons, the static inline plugin_call() function managed to corrupt the struct env_set *es pointer. The result was that es->list pointed at an invalid address, which again caused SEGV.

This patch replaces the static inline function with a macro instead, and let the plugin_call_ssl() keep all its arguments - no matter if SSL is enabled or not.

Quoted 7 lines

This issues appeared first in commit 1876ccd012e9e2ca6f8e1cd9e7e9bb4bf24ccecb, which does modify the plugin system.

5 +---- plugin.h | 21 +++------------------ 2 files changed, 4
insertions(+), 22 deletions(-)

This patch is obsoleted by this patch:
<http://thread.gmane.org/gmane.network.openvpn.devel/5080/focus=5076>

kind regards,

David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk635tgACgkQDC186MBRfrqDzwCggGdglsuRKYERtPMpET7U5ewT wHYAn1koidWoqGEOtda6hMotf1vze36f
=GFgo
-----END PGP SIGNATURE-----