diff options
Diffstat (limited to 'libc/bionic/__strcpy_chk.cpp')
-rw-r--r-- | libc/bionic/__strcpy_chk.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/libc/bionic/__strcpy_chk.cpp b/libc/bionic/__strcpy_chk.cpp index 5aa0e93..1f6bc80 100644 --- a/libc/bionic/__strcpy_chk.cpp +++ b/libc/bionic/__strcpy_chk.cpp @@ -28,7 +28,7 @@ #include <string.h> #include <stdlib.h> -#include "libc_logging.h" +#include "private/libc_logging.h" /* * Runtime implementation of __builtin____strcpy_chk. @@ -41,13 +41,13 @@ * This strcpy check is called if _FORTIFY_SOURCE is defined and * greater than 0. */ -extern "C" char *__strcpy_chk (char *dest, const char *src, size_t dest_len) { - // TODO: optimize so we don't scan src twice. - size_t src_len = strlen(src) + 1; - if (__predict_false(src_len > dest_len)) { - __fortify_chk_fail("strcpy buffer overflow", - BIONIC_EVENT_STRCPY_BUFFER_OVERFLOW); - } +extern "C" char* __strcpy_chk (char* dest, const char* src, size_t dest_len) { + // TODO: optimize so we don't scan src twice. + size_t src_len = strlen(src) + 1; + if (__predict_false(src_len > dest_len)) { + __fortify_chk_fail("strcpy: prevented write past end of buffer", + BIONIC_EVENT_STRCPY_BUFFER_OVERFLOW); + } - return strcpy(dest, src); + return strcpy(dest, src); } |