Skip to contentSkip to conversation

Fix unintialized variable in plugin_vlog()

PATCH In review Steffan Karger 2 participants 2 messages Nov 8, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix unintialized variable in plugin_vlog()

Does not seem to be a problem in normal usage, because one of the PLOG_ERR, PLOG_WARN, PLOG_NOTE or PLOG_DEBUG will be set, and will cause msg_flags to be initialized. In the worst case, msg_flags might accidentally end up having M_FATAL set, causing openvpn to exit.

This was previously fixed in the master branch (5ead2ae0), but was not backported to release/2.3, probably because that commit fixed other parts of the code too, and those parts are quite different between master and release/2.3.

Re-discovered by coverity.

---
 src/openvpn/plugin.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/openvpn/plugin.c +1 -1
index 0948f23..54c5b52 100644
@@ -291,7 +291,7 @@ plugin_init_item (struct plugin *p, const struct plugin_option *o)
 static void
 plugin_vlog (openvpn_plugin_log_flags_t flags, const char *name, const char *format, va_list arglist)
 {
-  unsigned int msg_flags;
+  unsigned int msg_flags = 0;
 
   if (!format)
     return;
Signature · 1 line
2.5.0
#1 lore raw

Your patch has been applied to the release/2.3 branch.

commit acc74694293b85dd9d8ef129c068b8ce5058dee1

Author: Steffan Karger
Date:   Sun Nov 8 13:04:27 2015 +0100
     Fix unintialized variable in plugin_vlog()

     Signed-off-by: Steffan Karger <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: http://article.gmane.org/gmane.network.openvpn.devel/10450
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering