[llvm-commits] [llvm] r58009 - /llvm/trunk/include/llvm/ADT/StringExtras.h
Ted Kremenek
kremenek at apple.com
Wed Oct 22 16:16:52 PDT 2008
Author: kremenek
Date: Wed Oct 22 18:16:52 2008
New Revision: 58009
URL: http://llvm.org/viewvc/llvm-project?rev=58009&view=rev
Log:
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.
Modified:
llvm/trunk/include/llvm/ADT/StringExtras.h
Modified: llvm/trunk/include/llvm/ADT/StringExtras.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringExtras.h?rev=58009&r1=58008&r2=58009&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/StringExtras.h (original)
+++ llvm/trunk/include/llvm/ADT/StringExtras.h Wed Oct 22 18:16:52 2008
@@ -159,7 +159,7 @@
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;
}
More information about the llvm-commits
mailing list