[Linux-ha-dev] [PATCH] [STONITH] ipmilan: fix potential segvfault
in options parsing
Simon Horman
horms at verge.net.au
Thu Aug 9 03:36:18 MDT 2007
Andrew Beekhof suggseted that namestocopy[x].s_value might be NULL.
Can it be? If so this patch fixes a potential segfault.
Cc: Sean Reifschneider <jafo at tummy.com>
Cc: Andrew Beekhof <beekhof at gmail.com>
Signed-off-by: Simon Horman <horms at verge.net.au>
Index: heartbeat/lib/plugins/stonith/ipmilan.c
===================================================================
--- heartbeat.orig/lib/plugins/stonith/ipmilan.c 2007-08-09 18:32:17.000000000 +0900
+++ heartbeat/lib/plugins/stonith/ipmilan.c 2007-08-09 18:33:48.000000000 +0900
@@ -411,7 +411,11 @@ ipmilan_set_config(StonithPlugin* s, Sto
tmp->ipaddr = namestocopy[1].s_value;
tmp->portnumber = atoi(namestocopy[2].s_value);
FREE(namestocopy[2].s_value);
- if (strcmp(namestocopy[3].s_value, "none") == 0) {
+ if (namestocopy[3].s_value == NULL) {
+ LOG(PIL_CRIT, "ipmilan auth type is NULL. See "
+ "README.ipmilan for allowed values");
+ return S_OOPS;
+ } else if (strcmp(namestocopy[3].s_value, "none") == 0) {
tmp->authtype = 0;
} else if (strcmp(namestocopy[3].s_value, "md2") == 0) {
tmp->authtype = 1;
@@ -427,6 +431,10 @@ ipmilan_set_config(StonithPlugin* s, Sto
return S_OOPS;
}
FREE(namestocopy[3].s_value);
+ if (namestocopy[4].s_value == NULL) {
+ LOG(PIL_CRIT, "ipmilan priv value is NULL. See "
+ "README.ipmilan for allowed values");
+ return S_OOPS;
if (strcmp(namestocopy[4].s_value, "operator") == 0) {
tmp->privilege = 3;
}
More information about the Linux-HA-Dev
mailing list