diff options
| author | Kamil Rytarowski <n54@gmx.com> | 2018-02-02 13:56:52 +0000 |
|---|---|---|
| committer | Kamil Rytarowski <n54@gmx.com> | 2018-02-02 13:56:52 +0000 |
| commit | 42983551bd76a6b7c8819d2e2e4ac2fb2baff2e1 (patch) | |
| tree | 494044cb730c1bf815809c190315d1565a0fc384 | |
| parent | 26f2eec212dbba6c0460152615d63718b578dc24 (diff) | |
| download | bcm5719-llvm-42983551bd76a6b7c8819d2e2e4ac2fb2baff2e1.tar.gz bcm5719-llvm-42983551bd76a6b7c8819d2e2e4ac2fb2baff2e1.zip | |
Correct the return value of strlcat(3) in the interceptor
Late fix for SVN r. 324034
Add new interceptors: strlcpy(3) and strlcat(3)
There was forgotten an addition of len to the return value.
llvm-svn: 324091
| -rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc index e6121c3c806..6e338a43573 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc @@ -6741,16 +6741,15 @@ INTERCEPTOR(SIZE_T, strlcpy, char *dst, char *src, SIZE_T size) { INTERCEPTOR(SIZE_T, strlcat, char *dst, char *src, SIZE_T size) { void *ctx; + SIZE_T len = 0; COMMON_INTERCEPTOR_ENTER(ctx, strlcat, dst, src, size); // src is checked in the strlcpy() interceptor if (dst) { - SIZE_T len = REAL(strnlen)(dst, size); + len = REAL(strnlen)(dst, size); COMMON_INTERCEPTOR_READ_STRING(ctx, dst, Min(len, size - 1) + 1); - // Reuse the rest of the code in the strlcpy() interceptor - dst += len; - size -= len; } - return WRAP(strlcpy)(dst, src, size); + // Reuse the rest of the code in the strlcpy() interceptor + return WRAP(strlcpy)(dst + len, src, size - len) + len; } #define INIT_STRLCPY \ COMMON_INTERCEPT_FUNCTION(strlcpy); \ |

