diff options
author | Tanya Lattner <tonic@nondot.org> | 2008-10-23 05:01:25 +0000 |
---|---|---|
committer | Tanya Lattner <tonic@nondot.org> | 2008-10-23 05:01:25 +0000 |
commit | 9768c466b52b71514728d3864a5c0c612b3485dc (patch) | |
tree | a9496f4f530945c89b47087f363183f20b0f5dab | |
parent | 51132465ec8c326f50eb3f00e8705589aaf21797 (diff) | |
download | llvm-9768c466b52b71514728d3864a5c0c612b3485dc.zip llvm-9768c466b52b71514728d3864a5c0c612b3485dc.tar.gz llvm-9768c466b52b71514728d3864a5c0c612b3485dc.tar.bz2 |
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.
llvm-svn: 58031
-rw-r--r-- | llvm/include/llvm/ADT/StringExtras.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/include/llvm/ADT/StringExtras.h b/llvm/include/llvm/ADT/StringExtras.h index 87b8ba6..3add73b 100644 --- a/llvm/include/llvm/ADT/StringExtras.h +++ b/llvm/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; } |