Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc =================================================================== --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc @@ -5340,7 +5340,7 @@ COMMON_INTERCEPTOR_FD_ACCESS(ctx, fd); SSIZE_T res = REAL(recv)(fd, buf, len, flags); if (res > 0) { - COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, len); + COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, res); } if (res >= 0 && fd >= 0) COMMON_INTERCEPTOR_FD_ACQUIRE(ctx, fd); return res; @@ -5356,7 +5356,7 @@ if (srcaddr) srcaddr_sz = *addrlen; SSIZE_T res = REAL(recvfrom)(fd, buf, len, flags, srcaddr, addrlen); if (res > 0) { - COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, len); + COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, res); if (srcaddr) COMMON_INTERCEPTOR_INITIALIZE_RANGE(srcaddr, Min((SIZE_T)*addrlen, srcaddr_sz)); Index: compiler-rt/trunk/test/asan/TestCases/Linux/recvfrom.cc =================================================================== --- compiler-rt/trunk/test/asan/TestCases/Linux/recvfrom.cc +++ compiler-rt/trunk/test/asan/TestCases/Linux/recvfrom.cc @@ -33,7 +33,7 @@ fprintf(stderr, "ERROR on binding\n"); recvfrom(sockfd, buf, kBufSize, 0, NULL, NULL); // BOOM - // CHECK: {{WRITE of size 10 at 0x.* thread T1}} + // CHECK: {{WRITE of size 9 at 0x.* thread T1}} // CHECK: {{ #1 0x.* in server_thread_udp.*recvfrom.cc:}}[[@LINE-2]] // CHECK: {{Address 0x.* is located in stack of thread T1 at offset}} // CHECK-NEXT: in{{.*}}server_thread_udp{{.*}}recvfrom.cc