aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTanya Lattner <tonic@nondot.org>2008-10-23 05:01:25 +0000
committerTanya Lattner <tonic@nondot.org>2008-10-23 05:01:25 +0000
commit07b9e8f94e1cb6dc10c5eea177b0461bcbea9317 (patch)
treecac7632305963b92757e598af8079c1f049d09c8
parent43b4e355472b2c25e4ebf0946594945dc1f1b43a (diff)
Merge from mainline
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/branches/release_24@58031 91177308-0d34-0410-b5e6-96231b3b80d8
-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 87b8ba6596..3add73b6fc 100644
--- a/include/llvm/ADT/StringExtras.h
+++ b/include/llvm/ADT/StringExtras.h
@@ -156,7 +156,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;
}