[PATCH] D31457: [asan] Add strndup/__strndup interceptors if targeting linux.
Vitaly Buka via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 17 18:07:21 PDT 2017
vitalybuka added inline comments.
================
Comment at: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc:230
+ uptr from_length = internal_strnlen(s, size); \
+ uptr copy_length = Min(size, from_length); \
+ char *new_mem = (char *)WRAP(malloc)(copy_length + 1); \
----------------
Min() is redundant here, as (internal_strnlen(s, size) <= size)
================
Comment at: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc:233
+ if (common_flags()->intercept_strndup) { \
+ COMMON_INTERCEPTOR_READ_RANGE(ctx, s, copy_length + 1); \
+ } \
----------------
must be "COMMON_INTERCEPTOR_READ_RANGE(ctx, s, Min(copy_length + 1, size)); "
(copy_length + 1) is a problem if "s" is not zero terminated
Repository:
rL LLVM
https://reviews.llvm.org/D31457
More information about the llvm-commits
mailing list