From e936e3f9ea190db91d4c22218338a80af9f3d412 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 1 Feb 2014 09:08:30 +0000 Subject: missing checks added git-svn-id: http://svn.miranda-ng.org/main/trunk@7982 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/mir_core/utils.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/mir_core') diff --git a/src/mir_core/utils.cpp b/src/mir_core/utils.cpp index 996654ea84..0da7cdadf8 100644 --- a/src/mir_core/utils.cpp +++ b/src/mir_core/utils.cpp @@ -144,7 +144,10 @@ MIR_CORE_DLL(WCHAR*) ltrimpw(WCHAR *str) MIR_CORE_DLL(int) wildcmp(const char *name, const char *mask) { - const char *last='\0'; + if (name == NULL || mask == NULL) + return false; + + const char *last = '\0'; for (;; mask++, name++) { if (*mask != '?' && *mask != *name) break; if (*name == '\0') return ((BOOL)!*mask); @@ -162,6 +165,9 @@ MIR_CORE_DLL(int) wildcmp(const char *name, const char *mask) MIR_CORE_DLL(int) wildcmpw(const WCHAR *name, const WCHAR *mask) { + if (name == NULL || mask == NULL) + return false; + const WCHAR* last = '\0'; for (;; mask++, name++) { if (*mask != '?' && *mask != *name) break; @@ -182,6 +188,9 @@ MIR_CORE_DLL(int) wildcmpw(const WCHAR *name, const WCHAR *mask) MIR_CORE_DLL(int) wildcmpi(const char *name, const char *mask) { + if (name == NULL || mask == NULL) + return false; + const char *last = NULL; for (;; mask++, name++) { if (*mask != '?' && _qtoupper(*mask) != _qtoupper(*name)) break; @@ -200,6 +209,9 @@ MIR_CORE_DLL(int) wildcmpi(const char *name, const char *mask) MIR_CORE_DLL(int) wildcmpiw(const WCHAR *name, const WCHAR *mask) { + if (name == NULL || mask == NULL) + return false; + const WCHAR* last = NULL; for (;; mask++, name++) { if (*mask != '?' && _qtoupper(*mask) != _qtoupper(*name)) break; -- cgit v1.2.3