clean up FORTIFY_SOURCE handling.
Avoid duplicating huge chunks of code.
Change-Id: Id6145cdfce781c5ffba2abaaa79681d25a7ab28f
diff --git a/libc/bionic/__strcat_chk.cpp b/libc/bionic/__strcat_chk.cpp
index ec194fc..2450da6 100644
--- a/libc/bionic/__strcat_chk.cpp
+++ b/libc/bionic/__strcat_chk.cpp
@@ -50,17 +50,13 @@
// sum = src_len + dest_len + 1 (with overflow protection)
if (!safe_add3(&sum, src_len, dest_len, 1U)) {
- __libc_android_log_print(ANDROID_LOG_FATAL, "libc",
- "*** strcat integer overflow detected ***\n");
- __libc_android_log_event_uid(BIONIC_EVENT_STRCAT_INTEGER_OVERFLOW);
- abort();
+ __fortify_chk_fail("strcat integer overflow",
+ BIONIC_EVENT_STRCAT_INTEGER_OVERFLOW);
}
if (sum > dest_buf_size) {
- __libc_android_log_print(ANDROID_LOG_FATAL, "libc",
- "*** strcat buffer overflow detected ***\n");
- __libc_android_log_event_uid(BIONIC_EVENT_STRNCAT_BUFFER_OVERFLOW);
- abort();
+ __fortify_chk_fail("strcat buffer overflow",
+ BIONIC_EVENT_STRCAT_BUFFER_OVERFLOW);
}
return strcat(dest, src);