FORTIFY_SOURCE: emphasize prevention in error messages.
FORTIFY_SOURCE prevents buffer overflows from occurring.
However, the error message often implies that we only
detect it, not prevent it.
Bring more clarity to the error messages by emphasizing
prevention over detection.
Change-Id: I5f3e1478673bdfc589e6cc4199fce8e52e197a24
diff --git a/libc/bionic/__strncpy_chk.cpp b/libc/bionic/__strncpy_chk.cpp
index 6b1a3c7..d362b34 100644
--- a/libc/bionic/__strncpy_chk.cpp
+++ b/libc/bionic/__strncpy_chk.cpp
@@ -45,7 +45,7 @@
size_t len, size_t dest_len)
{
if (__predict_false(len > dest_len)) {
- __fortify_chk_fail("strncpy dest buffer overflow",
+ __fortify_chk_fail("strncpy dest buffer overflow prevented",
BIONIC_EVENT_STRNCPY_BUFFER_OVERFLOW);
}
@@ -64,7 +64,7 @@
size_t n, size_t dest_len, size_t src_len)
{
if (__predict_false(n > dest_len)) {
- __fortify_chk_fail("strncpy dest buffer overflow",
+ __fortify_chk_fail("strncpy dest buffer overflow prevented",
BIONIC_EVENT_STRNCPY_BUFFER_OVERFLOW);
}
if (n != 0) {
@@ -83,7 +83,7 @@
size_t s_copy_len = static_cast<size_t>(s - src);
if (__predict_false(s_copy_len > src_len)) {
- __fortify_chk_fail("strncpy read beyond end of src buffer", 0);
+ __fortify_chk_fail("strncpy buffer overrun prevented", 0);
}
}