diff options
| author | Elliott Hughes <enh@google.com> | 2016-05-25 17:01:31 -0700 |
|---|---|---|
| committer | Elliott Hughes <enh@google.com> | 2016-05-26 14:55:00 -0700 |
| commit | c75da09f4fb4ee24f14d40de6f47f03ee29b1ba1 (patch) | |
| tree | 304e2932b31d1c27ebb852622964d9f4d30f37c7 /libc/bionic/fortify.cpp | |
| parent | e85de5b103388f047cc307a362ee8cdc6ef010ec (diff) | |
Improve diagnostics from the assembler __strcat_chk routines.
Change-Id: I44cbe5389c66de6618e581a6e302eea22c39d6fb
Diffstat (limited to 'libc/bionic/fortify.cpp')
| -rw-r--r-- | libc/bionic/fortify.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libc/bionic/fortify.cpp b/libc/bionic/fortify.cpp index ad7aa04f3..278c606e1 100644 --- a/libc/bionic/fortify.cpp +++ b/libc/bionic/fortify.cpp @@ -268,6 +268,12 @@ char* __stpncpy_chk2(char* __restrict dst, const char* __restrict src, return dst; } +// strcat is performance-critical enough that we have assembler __strcat_chk implementations. +// This function is used to give better diagnostics than we can easily do from assembler. +extern "C" void __strcat_chk_fail(size_t dst_buf_size) { + __fortify_fatal("strcat: prevented write past end of %zu-byte buffer", dst_buf_size); +} + char* __strchr_chk(const char* p, int ch, size_t s_len) { for (;; ++p, s_len--) { if (__predict_false(s_len == 0)) { |
