Commit 9768c466 authored by Tanya Lattner's avatar Tanya Lattner
Browse files

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
parent 51132465
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;
    }