[tsan] use internal_strnlen in strncpy interceptor (the bug found while booting chromium)

llvm-svn: 160171
This commit is contained in:
Kostya Serebryany 2012-07-13 13:04:43 +00:00
parent 73221f5624
commit 38f318bf20
1 changed files with 1 additions and 1 deletions

View File

@ -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);