tsan: fix potential NULL deref

llvm-svn: 157047
This commit is contained in:
Dmitry Vyukov 2012-05-18 08:53:16 +00:00
parent b638ee0ed3
commit bea47a5029
1 changed files with 1 additions and 1 deletions

View File

@ -295,7 +295,7 @@ TSAN_INTERCEPTOR(int, strcmp, const char *s1, const char *s2) {
TSAN_INTERCEPTOR(int, strncmp, const char *s1, const char *s2, uptr n) {
SCOPED_TSAN_INTERCEPTOR(strncmp, s1, s2, n);
uptr len = 0;
for (; s1[len] && s2[len] && len < n; len++) {
for (; len < n && s1[len] && s2[len]; len++) {
if (s1[len] != s2[len])
break;
}