summaryrefslogtreecommitdiff
path: root/include/llvm/ADT/StringExtras.h
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-10-22 23:16:52 +0000
committerTed Kremenek <kremenek@apple.com>2008-10-22 23:16:52 +0000
commit30f100e14056c2fd88a3448c8bf89b656e7d8584 (patch)
tree30ee18073df7de7f0ee605db6a6b6d19070be936 /include/llvm/ADT/StringExtras.h
parentc64bdf6aa5160471dfda49a78d4a0e08bc07ac0d (diff)
downloadllvm-30f100e14056c2fd88a3448c8bf89b656e7d8584.tar.gz
llvm-30f100e14056c2fd88a3448c8bf89b656e7d8584.tar.bz2
llvm-30f100e14056c2fd88a3448c8bf89b656e7d8584.tar.xz
Fix incorrect testing for the end of the both strings in CStrInCStrNoCase. This could cause a read-out-of-bounds error if s2 is smaller than s1.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58009 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/StringExtras.h')
-rw-r--r--include/llvm/ADT/StringExtras.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/llvm/ADT/StringExtras.h b/include/llvm/ADT/StringExtras.h
index 872c8451bf..fcd03982e6 100644
--- a/include/llvm/ADT/StringExtras.h
+++ b/include/llvm/ADT/StringExtras.h
@@ -159,7 +159,7 @@ static inline const char* CStrInCStrNoCase(const char *s1, const char *s2) {
const char *I1=s1, *I2=s2;
- while (*I1 != '\0' || *I2 != '\0' )
+ while (*I1 != '\0' && *I2 != '\0' )
if (tolower(*I1) != tolower(*I2)) { // No match. Start over.
++s1; I1 = s1; I2 = s2;
}