From: VMware, Inc <> Date: Tue, 13 Mar 2012 20:08:37 +0000 (-0700) Subject: Trivial fix to check for NULL pointer prior to strncmp X-Git-Tag: 2012.03.13-651368~40 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8bc130b1b797ac3b8cca2ab32b8fa436271a8a47;p=thirdparty%2Fopen-vm-tools.git Trivial fix to check for NULL pointer prior to strncmp The MSG_MAGICAL() macro needs to check for a NULL pointer prior to calling strncmp on it. Signed-off-by: Dmitry Torokhov --- diff --git a/open-vm-tools/lib/include/msgid.h b/open-vm-tools/lib/include/msgid.h index 59503d1b8..4355c3365 100644 --- a/open-vm-tools/lib/include/msgid.h +++ b/open-vm-tools/lib/include/msgid.h @@ -39,7 +39,8 @@ // the X hides MSG_MAGIC so it won't appear in the object file -#define MSG_MAGICAL(s) (strncmp(s, MSG_MAGIC"X", MSG_MAGIC_LEN) == 0) +#define MSG_MAGICAL(s) \ + (s != NULL && strncmp(s, MSG_MAGIC"X", MSG_MAGIC_LEN) == 0) // Start after MSG_MAGIC so it won't appear in the object file either. #define MSG_HAS_BUTTONID(s) \