From 38f318bf2022abb11f1eff0da7aa12afe7809998 Mon Sep 17 00:00:00 2001 From: Kostya Serebryany Date: Fri, 13 Jul 2012 13:04:43 +0000 Subject: [PATCH] [tsan] use internal_strnlen in strncpy interceptor (the bug found while booting chromium) llvm-svn: 160171 --- compiler-rt/lib/tsan/rtl/tsan_interceptors.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc b/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc index 5dbaf866beec..a962250568b7 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc +++ b/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc @@ -476,7 +476,7 @@ TSAN_INTERCEPTOR(char*, strcpy, char *dst, const char *src) { // NOLINT TSAN_INTERCEPTOR(char*, strncpy, char *dst, char *src, uptr n) { SCOPED_TSAN_INTERCEPTOR(strncpy, dst, src, n); - uptr srclen = internal_strlen(src); + uptr srclen = internal_strnlen(src, n); MemoryAccessRange(thr, pc, (uptr)dst, n, true); MemoryAccessRange(thr, pc, (uptr)src, min(srclen + 1, n), false); return REAL(strncpy)(dst, src, n);