summaryrefslogtreecommitdiffstats
path: root/llvm
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
commit5902794c8c81e271dee7014a2d9d8b6f5a3fee7e (patch)
tree8042db0a32863a35d94429bc3520961a65273f55 /llvm
parent1a527ea1e514b38c3f1653f9785c6ab02d4560ef (diff)
downloadbcm5719-llvm-5902794c8c81e271dee7014a2d9d8b6f5a3fee7e.tar.gz
bcm5719-llvm-5902794c8c81e271dee7014a2d9d8b6f5a3fee7e.zip
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.
llvm-svn: 58009
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/ADT/StringExtras.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/include/llvm/ADT/StringExtras.h b/llvm/include/llvm/ADT/StringExtras.h
index 872c8451bf5..fcd03982e61 100644
--- a/llvm/include/llvm/ADT/StringExtras.h
+++ b/llvm/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;
}
OpenPOWER on IntegriCloud