From: VMware, Inc <> Date: Tue, 13 Mar 2012 20:08:42 +0000 (-0700) Subject: Check for NULL before calling strcmp(). X-Git-Tag: 2012.03.13-651368~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6da9432523815ec0148abbfed2955265b68dcafd;p=thirdparty%2Fopen-vm-tools.git Check for NULL before calling strcmp(). In few code paths, we pass NULL value to the strcmp() functions which may result in a crash. Modified the code to implement NULL checks before calling strcmp() function. Signed-off-by: Dmitry Torokhov --- diff --git a/open-vm-tools/services/plugins/vix/vixTools.c b/open-vm-tools/services/plugins/vix/vixTools.c index 3f6bf5d64..459c9172d 100644 --- a/open-vm-tools/services/plugins/vix/vixTools.c +++ b/open-vm-tools/services/plugins/vix/vixTools.c @@ -2568,11 +2568,13 @@ VixToolsGetAPIDisabledFromConf(GKeyFile *confDictRef, // IN /* * Make sure vgauth related stuff does not show as enabled. */ - if ((strcmp(varName, VIX_TOOLS_CONFIG_API_ADD_AUTH_PRINCIPAL_NAME) == 0) || - (strcmp(varName, VIX_TOOLS_CONFIG_API_REMOVE_AUTH_PRINCIPAL_NAME) == 0) || - (strcmp(varName, VIX_TOOLS_CONFIG_API_LIST_AUTH_PRINCIPALS_NAME) == 0) || - (strcmp(varName, VIX_TOOLS_CONFIG_API_LIST_MAPPED_PRINCIPALS_NAME) == 0)) { - disabled = TRUE; + if (NULL != varName) { + if ((strcmp(varName, VIX_TOOLS_CONFIG_API_ADD_AUTH_PRINCIPAL_NAME) == 0) || + (strcmp(varName, VIX_TOOLS_CONFIG_API_REMOVE_AUTH_PRINCIPAL_NAME) == 0) || + (strcmp(varName, VIX_TOOLS_CONFIG_API_LIST_AUTH_PRINCIPALS_NAME) == 0) || + (strcmp(varName, VIX_TOOLS_CONFIG_API_LIST_MAPPED_PRINCIPALS_NAME) == 0)) { + disabled = TRUE; + } } #endif