From 6861c6f85e6563695c4763e56756398c9d5f6e14 Mon Sep 17 00:00:00 2001 From: Nick Kralevich Date: Fri, 4 Oct 2013 09:45:24 -0700 Subject: [PATCH] Make error messages even better! Change-Id: I72bd1eb1d526dc59833e5bc3c636171f7f9545af --- libc/arch-arm/cortex-a15/bionic/__strcat_chk.S | 2 +- libc/arch-arm/cortex-a15/bionic/__strcpy_chk.S | 2 +- libc/arch-arm/cortex-a15/bionic/memcpy.S | 2 +- libc/arch-arm/cortex-a15/bionic/memset.S | 2 +- libc/arch-arm/cortex-a9/bionic/__strcat_chk.S | 2 +- libc/arch-arm/cortex-a9/bionic/__strcpy_chk.S | 2 +- libc/arch-arm/cortex-a9/bionic/memcpy.S | 2 +- libc/arch-arm/cortex-a9/bionic/memset.S | 2 +- libc/arch-arm/generic/bionic/memcpy.S | 2 +- libc/arch-arm/generic/bionic/memset.S | 2 +- libc/arch-arm/krait/bionic/__strcat_chk.S | 2 +- libc/arch-arm/krait/bionic/__strcpy_chk.S | 2 +- libc/arch-arm/krait/bionic/memcpy.S | 2 +- libc/arch-arm/krait/bionic/memset.S | 2 +- libc/bionic/__fgets_chk.cpp | 2 +- libc/bionic/__memcpy_chk.cpp | 2 +- libc/bionic/__memmove_chk.cpp | 2 +- libc/bionic/__memset_chk.cpp | 2 +- libc/bionic/__recvfrom_chk.cpp | 2 +- libc/bionic/__strcat_chk.cpp | 2 +- libc/bionic/__strchr_chk.cpp | 2 +- libc/bionic/__strcpy_chk.cpp | 2 +- libc/bionic/__strlcat_chk.cpp | 2 +- libc/bionic/__strlcpy_chk.cpp | 2 +- libc/bionic/__strlen_chk.cpp | 2 +- libc/bionic/__strncat_chk.cpp | 2 +- libc/bionic/__strncpy_chk.cpp | 6 +++--- libc/bionic/__strrchr_chk.cpp | 2 +- libc/bionic/__vsnprintf_chk.cpp | 2 +- libc/bionic/__vsprintf_chk.cpp | 2 +- 30 files changed, 32 insertions(+), 32 deletions(-) diff --git a/libc/arch-arm/cortex-a15/bionic/__strcat_chk.S b/libc/arch-arm/cortex-a15/bionic/__strcat_chk.S index a5b82aa35..efa959560 100644 --- a/libc/arch-arm/cortex-a15/bionic/__strcat_chk.S +++ b/libc/arch-arm/cortex-a15/bionic/__strcat_chk.S @@ -224,4 +224,4 @@ END(__strcat_chk_failed) .data error_string: - .string "strcat buffer overflow" + .string "strcat prevented write past end of buffer" diff --git a/libc/arch-arm/cortex-a15/bionic/__strcpy_chk.S b/libc/arch-arm/cortex-a15/bionic/__strcpy_chk.S index 37ad06c6e..cd91dfc9f 100644 --- a/libc/arch-arm/cortex-a15/bionic/__strcpy_chk.S +++ b/libc/arch-arm/cortex-a15/bionic/__strcpy_chk.S @@ -185,4 +185,4 @@ END(__strcpy_chk_failed) .data error_string: - .string "strcpy buffer overflow" + .string "strcpy prevented write past end of buffer" diff --git a/libc/arch-arm/cortex-a15/bionic/memcpy.S b/libc/arch-arm/cortex-a15/bionic/memcpy.S index 3d23a1c8e..a1ef6f5b5 100644 --- a/libc/arch-arm/cortex-a15/bionic/memcpy.S +++ b/libc/arch-arm/cortex-a15/bionic/memcpy.S @@ -109,4 +109,4 @@ END(__memcpy_chk_fail) .data error_string: - .string "memcpy buffer overflow" + .string "memcpy prevented write past end of buffer" diff --git a/libc/arch-arm/cortex-a15/bionic/memset.S b/libc/arch-arm/cortex-a15/bionic/memset.S index b5fc6babd..72e83cc76 100644 --- a/libc/arch-arm/cortex-a15/bionic/memset.S +++ b/libc/arch-arm/cortex-a15/bionic/memset.S @@ -197,4 +197,4 @@ END(memset) .data error_string: - .string "memset buffer overflow" + .string "memset prevented write past end of buffer" diff --git a/libc/arch-arm/cortex-a9/bionic/__strcat_chk.S b/libc/arch-arm/cortex-a9/bionic/__strcat_chk.S index ffc440e5b..daea34cf1 100644 --- a/libc/arch-arm/cortex-a9/bionic/__strcat_chk.S +++ b/libc/arch-arm/cortex-a9/bionic/__strcat_chk.S @@ -227,4 +227,4 @@ END(__strcat_chk_fail) .data error_string: - .string "strcat buffer overflow" + .string "strcat prevented write past end of buffer" diff --git a/libc/arch-arm/cortex-a9/bionic/__strcpy_chk.S b/libc/arch-arm/cortex-a9/bionic/__strcpy_chk.S index b19766771..d4e0c0aef 100644 --- a/libc/arch-arm/cortex-a9/bionic/__strcpy_chk.S +++ b/libc/arch-arm/cortex-a9/bionic/__strcpy_chk.S @@ -191,4 +191,4 @@ END(__strcpy_chk_fail) .data error_string: - .string "strcpy buffer overflow" + .string "strcpy prevented write past end of buffer" diff --git a/libc/arch-arm/cortex-a9/bionic/memcpy.S b/libc/arch-arm/cortex-a9/bionic/memcpy.S index 64b00d800..9faea96fd 100644 --- a/libc/arch-arm/cortex-a9/bionic/memcpy.S +++ b/libc/arch-arm/cortex-a9/bionic/memcpy.S @@ -89,4 +89,4 @@ END(__memcpy_chk_fail) .data error_string: - .string "memcpy buffer overflow" + .string "memcpy prevented write past end of buffer" diff --git a/libc/arch-arm/cortex-a9/bionic/memset.S b/libc/arch-arm/cortex-a9/bionic/memset.S index f6be66a03..9609db93c 100644 --- a/libc/arch-arm/cortex-a9/bionic/memset.S +++ b/libc/arch-arm/cortex-a9/bionic/memset.S @@ -201,4 +201,4 @@ END(__memset_large_copy) .data error_string: - .string "memset buffer overflow" + .string "memset prevented write past end of buffer" diff --git a/libc/arch-arm/generic/bionic/memcpy.S b/libc/arch-arm/generic/bionic/memcpy.S index 24373d815..c5168d6e2 100644 --- a/libc/arch-arm/generic/bionic/memcpy.S +++ b/libc/arch-arm/generic/bionic/memcpy.S @@ -401,4 +401,4 @@ END(memcpy) .data error_string: - .string "memcpy buffer overflow" + .string "memcpy prevented write past end of buffer" diff --git a/libc/arch-arm/generic/bionic/memset.S b/libc/arch-arm/generic/bionic/memset.S index 399bae91e..47dcedd70 100644 --- a/libc/arch-arm/generic/bionic/memset.S +++ b/libc/arch-arm/generic/bionic/memset.S @@ -130,4 +130,4 @@ END(memset) .data error_string: - .string "memset buffer overflow" + .string "memset prevented write past end of buffer" diff --git a/libc/arch-arm/krait/bionic/__strcat_chk.S b/libc/arch-arm/krait/bionic/__strcat_chk.S index bb4bb8675..00fd01ea5 100644 --- a/libc/arch-arm/krait/bionic/__strcat_chk.S +++ b/libc/arch-arm/krait/bionic/__strcat_chk.S @@ -222,4 +222,4 @@ END(__strcat_chk_failed) .data error_string: - .string "strcat buffer overflow" + .string "strcat prevented write past end of buffer" diff --git a/libc/arch-arm/krait/bionic/__strcpy_chk.S b/libc/arch-arm/krait/bionic/__strcpy_chk.S index 1116cf6d1..3c802b513 100644 --- a/libc/arch-arm/krait/bionic/__strcpy_chk.S +++ b/libc/arch-arm/krait/bionic/__strcpy_chk.S @@ -184,4 +184,4 @@ END(__strcpy_chk_failed) .data error_string: - .string "strcpy buffer overflow" + .string "strcpy prevented write past end of buffer" diff --git a/libc/arch-arm/krait/bionic/memcpy.S b/libc/arch-arm/krait/bionic/memcpy.S index f7277fcdb..d3278d23b 100644 --- a/libc/arch-arm/krait/bionic/memcpy.S +++ b/libc/arch-arm/krait/bionic/memcpy.S @@ -89,4 +89,4 @@ END(__memcpy_chk_fail) .data error_string: - .string "memcpy buffer overflow" + .string "memcpy prevented write past end of buffer" diff --git a/libc/arch-arm/krait/bionic/memset.S b/libc/arch-arm/krait/bionic/memset.S index 005dfd8cf..6595e1fc6 100644 --- a/libc/arch-arm/krait/bionic/memset.S +++ b/libc/arch-arm/krait/bionic/memset.S @@ -116,4 +116,4 @@ END(memset) .data error_string: - .string "memset buffer overflow" + .string "memset prevented write past end of buffer" diff --git a/libc/bionic/__fgets_chk.cpp b/libc/bionic/__fgets_chk.cpp index 32b608e71..7f6b0678a 100644 --- a/libc/bionic/__fgets_chk.cpp +++ b/libc/bionic/__fgets_chk.cpp @@ -49,7 +49,7 @@ extern "C" char *__fgets_chk(char *dest, int supplied_size, } if (((size_t) supplied_size) > dest_len_from_compiler) { - __fortify_chk_fail("fgets buffer overflow prevented", 0); + __fortify_chk_fail("fgets prevented write past end of buffer", 0); } return fgets(dest, supplied_size, stream); diff --git a/libc/bionic/__memcpy_chk.cpp b/libc/bionic/__memcpy_chk.cpp index b95a0d77f..2839795af 100644 --- a/libc/bionic/__memcpy_chk.cpp +++ b/libc/bionic/__memcpy_chk.cpp @@ -46,7 +46,7 @@ extern "C" void *__memcpy_chk(void *dest, const void *src, size_t copy_amount, size_t dest_len) { if (__predict_false(copy_amount > dest_len)) { - __fortify_chk_fail("memcpy buffer overflow prevented", + __fortify_chk_fail("memcpy prevented write past end of buffer", BIONIC_EVENT_MEMCPY_BUFFER_OVERFLOW); } diff --git a/libc/bionic/__memmove_chk.cpp b/libc/bionic/__memmove_chk.cpp index 5f5113990..b653968f6 100644 --- a/libc/bionic/__memmove_chk.cpp +++ b/libc/bionic/__memmove_chk.cpp @@ -45,7 +45,7 @@ extern "C" void *__memmove_chk (void *dest, const void *src, size_t len, size_t dest_len) { if (__predict_false(len > dest_len)) { - __fortify_chk_fail("memmove buffer overflow prevented", + __fortify_chk_fail("memmove prevented write past end of buffer", BIONIC_EVENT_MEMMOVE_BUFFER_OVERFLOW); } diff --git a/libc/bionic/__memset_chk.cpp b/libc/bionic/__memset_chk.cpp index 04c772b0e..49a15484e 100644 --- a/libc/bionic/__memset_chk.cpp +++ b/libc/bionic/__memset_chk.cpp @@ -43,7 +43,7 @@ */ extern "C" void *__memset_chk (void *dest, int c, size_t n, size_t dest_len) { if (__predict_false(n > dest_len)) { - __fortify_chk_fail("memset buffer overflow prevented", + __fortify_chk_fail("memset prevented write past end of buffer", BIONIC_EVENT_MEMSET_BUFFER_OVERFLOW); } diff --git a/libc/bionic/__recvfrom_chk.cpp b/libc/bionic/__recvfrom_chk.cpp index 3a9dab6fd..0c042cc22 100644 --- a/libc/bionic/__recvfrom_chk.cpp +++ b/libc/bionic/__recvfrom_chk.cpp @@ -37,7 +37,7 @@ ssize_t __recvfrom_chk(int socket, void* buf, size_t len, size_t buflen, unsigne const struct sockaddr* src_addr, socklen_t* addrlen) { if (__predict_false(len > buflen)) { - __fortify_chk_fail("recvfrom buffer overflow prevented", 0); + __fortify_chk_fail("recvfrom prevented write past end of buffer", 0); } return recvfrom(socket, buf, len, flags, src_addr, addrlen); diff --git a/libc/bionic/__strcat_chk.cpp b/libc/bionic/__strcat_chk.cpp index 37ecfe646..3dda43a5b 100644 --- a/libc/bionic/__strcat_chk.cpp +++ b/libc/bionic/__strcat_chk.cpp @@ -55,7 +55,7 @@ extern "C" char* __strcat_chk( while ((*dest++ = *src++) != '\0') { dest_buf_size--; if (__predict_false(dest_buf_size == 0)) { - __fortify_chk_fail("strcat buffer overflow prevented", + __fortify_chk_fail("strcat prevented write past end of buffer", BIONIC_EVENT_STRCAT_BUFFER_OVERFLOW); } } diff --git a/libc/bionic/__strchr_chk.cpp b/libc/bionic/__strchr_chk.cpp index 87d889310..3982d6018 100644 --- a/libc/bionic/__strchr_chk.cpp +++ b/libc/bionic/__strchr_chk.cpp @@ -33,7 +33,7 @@ extern "C" char* __strchr_chk(const char* p, int ch, size_t s_len) { for (;; ++p, s_len--) { if (__predict_false(s_len == 0)) { - __fortify_chk_fail("strchr buffer overrun prevented", 0); + __fortify_chk_fail("strchr prevented read past end of buffer", 0); } if (*p == static_cast(ch)) { return const_cast(p); diff --git a/libc/bionic/__strcpy_chk.cpp b/libc/bionic/__strcpy_chk.cpp index e92e539fe..41990f990 100644 --- a/libc/bionic/__strcpy_chk.cpp +++ b/libc/bionic/__strcpy_chk.cpp @@ -45,7 +45,7 @@ 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 prevented", + __fortify_chk_fail("strcpy prevented write past end of buffer", BIONIC_EVENT_STRCPY_BUFFER_OVERFLOW); } diff --git a/libc/bionic/__strlcat_chk.cpp b/libc/bionic/__strlcat_chk.cpp index 5f970932b..32573c2e7 100644 --- a/libc/bionic/__strlcat_chk.cpp +++ b/libc/bionic/__strlcat_chk.cpp @@ -46,7 +46,7 @@ extern "C" size_t __strlcat_chk(char *dest, const char *src, size_t supplied_size, size_t dest_len_from_compiler) { if (__predict_false(supplied_size > dest_len_from_compiler)) { - __fortify_chk_fail("strlcat buffer overflow prevented", 0); + __fortify_chk_fail("strlcat prevented write past end of buffer", 0); } return strlcat(dest, src, supplied_size); diff --git a/libc/bionic/__strlcpy_chk.cpp b/libc/bionic/__strlcpy_chk.cpp index a6877eb58..1e482e1b0 100644 --- a/libc/bionic/__strlcpy_chk.cpp +++ b/libc/bionic/__strlcpy_chk.cpp @@ -46,7 +46,7 @@ extern "C" size_t __strlcpy_chk(char *dest, const char *src, size_t supplied_size, size_t dest_len_from_compiler) { if (__predict_false(supplied_size > dest_len_from_compiler)) { - __fortify_chk_fail("strlcpy buffer overflow prevented", 0); + __fortify_chk_fail("strlcpy prevented write past end of buffer", 0); } return strlcpy(dest, src, supplied_size); diff --git a/libc/bionic/__strlen_chk.cpp b/libc/bionic/__strlen_chk.cpp index 87be0e678..494f7bf04 100644 --- a/libc/bionic/__strlen_chk.cpp +++ b/libc/bionic/__strlen_chk.cpp @@ -57,7 +57,7 @@ extern "C" size_t __strlen_chk(const char *s, size_t s_len) { size_t ret = strlen(s); if (__predict_false(ret >= s_len)) { - __fortify_chk_fail("strlen buffer overrun prevented", 0); + __fortify_chk_fail("strlen prevented read past end of buffer", 0); } return ret; diff --git a/libc/bionic/__strncat_chk.cpp b/libc/bionic/__strncat_chk.cpp index 4f4b3271e..296217e9e 100644 --- a/libc/bionic/__strncat_chk.cpp +++ b/libc/bionic/__strncat_chk.cpp @@ -59,7 +59,7 @@ extern "C" char *__strncat_chk( len--; dest_buf_size--; if (__predict_false(dest_buf_size == 0)) { - __fortify_chk_fail("strncat buffer overflow prevented", + __fortify_chk_fail("strncat prevented write past end of buffer", BIONIC_EVENT_STRNCAT_BUFFER_OVERFLOW); } diff --git a/libc/bionic/__strncpy_chk.cpp b/libc/bionic/__strncpy_chk.cpp index d362b3410..5e72c2ccd 100644 --- a/libc/bionic/__strncpy_chk.cpp +++ b/libc/bionic/__strncpy_chk.cpp @@ -45,7 +45,7 @@ extern "C" char* __strncpy_chk(char* __restrict dest, const char* __restrict src size_t len, size_t dest_len) { if (__predict_false(len > dest_len)) { - __fortify_chk_fail("strncpy dest buffer overflow prevented", + __fortify_chk_fail("strncpy prevented write past end of buffer", BIONIC_EVENT_STRNCPY_BUFFER_OVERFLOW); } @@ -64,7 +64,7 @@ extern "C" char* __strncpy_chk2(char* __restrict dst, const char* __restrict src size_t n, size_t dest_len, size_t src_len) { if (__predict_false(n > dest_len)) { - __fortify_chk_fail("strncpy dest buffer overflow prevented", + __fortify_chk_fail("strncpy prevented write past end of buffer", BIONIC_EVENT_STRNCPY_BUFFER_OVERFLOW); } if (n != 0) { @@ -83,7 +83,7 @@ extern "C" char* __strncpy_chk2(char* __restrict dst, const char* __restrict src size_t s_copy_len = static_cast(s - src); if (__predict_false(s_copy_len > src_len)) { - __fortify_chk_fail("strncpy buffer overrun prevented", 0); + __fortify_chk_fail("strncpy prevented read past end of buffer", 0); } } diff --git a/libc/bionic/__strrchr_chk.cpp b/libc/bionic/__strrchr_chk.cpp index 2bdf36a70..e6daf8ff7 100644 --- a/libc/bionic/__strrchr_chk.cpp +++ b/libc/bionic/__strrchr_chk.cpp @@ -37,7 +37,7 @@ extern "C" char* __strrchr_chk(const char *p, int ch, size_t s_len) for (save = NULL;; ++p, s_len--) { if (s_len == 0) - __fortify_chk_fail("strrchr read overrun prevented", 0); + __fortify_chk_fail("strrchr prevented read past end of buffer", 0); if (*p == (char) ch) save = (char *)p; if (!*p) diff --git a/libc/bionic/__vsnprintf_chk.cpp b/libc/bionic/__vsnprintf_chk.cpp index 731f9c5cb..257cf5e72 100644 --- a/libc/bionic/__vsnprintf_chk.cpp +++ b/libc/bionic/__vsnprintf_chk.cpp @@ -51,7 +51,7 @@ extern "C" int __vsnprintf_chk( va_list va) { if (__predict_false(supplied_size > dest_len_from_compiler)) { - __fortify_chk_fail("vsnprintf buffer overflow prevented", 0); + __fortify_chk_fail("vsnprintf prevented write past end of buffer", 0); } return vsnprintf(dest, supplied_size, format, va); diff --git a/libc/bionic/__vsprintf_chk.cpp b/libc/bionic/__vsprintf_chk.cpp index 560f12e4f..290de9b8f 100644 --- a/libc/bionic/__vsprintf_chk.cpp +++ b/libc/bionic/__vsprintf_chk.cpp @@ -52,7 +52,7 @@ extern "C" int __vsprintf_chk( int ret = vsnprintf(dest, dest_len_from_compiler, format, va); if ((size_t) ret >= dest_len_from_compiler) { - __fortify_chk_fail("vsprintf buffer overflow prevented", 0); + __fortify_chk_fail("vsprintf prevented write past end of buffer", 0); } return ret;