clean up FORTIFY_SOURCE handling.

Avoid duplicating huge chunks of code.

Change-Id: Id6145cdfce781c5ffba2abaaa79681d25a7ab28f
This commit is contained in:
Nick Kralevich
2012-12-04 13:55:19 -08:00
parent db79e827eb
commit 326ea5413d
18 changed files with 43 additions and 70 deletions

View File

@@ -45,10 +45,8 @@ extern "C" char *__strncpy_chk (char *dest, const char *src,
size_t len, size_t dest_len)
{
if (len > dest_len) {
__libc_android_log_print(ANDROID_LOG_FATAL, "libc",
"*** strncpy buffer overflow detected ***\n");
__libc_android_log_event_uid(BIONIC_EVENT_STRNCPY_BUFFER_OVERFLOW);
abort();
__fortify_chk_fail("strncpy buffer overflow",
BIONIC_EVENT_STRNCPY_BUFFER_OVERFLOW);
}
return strncpy(dest, src, len);