diff options
author | Nick Kralevich <nnk@google.com> | 2012-07-13 12:45:14 -0700 |
---|---|---|
committer | Nick Kralevich <nnk@google.com> | 2012-07-13 13:49:45 -0700 |
commit | b2060b027c9eb2748895b53a0d69d40b52371a4e (patch) | |
tree | 00b0d9fa0f2bb7d106aff303feeb3ddbead6baeb /libc/string | |
parent | 88bfc28ac4d5f4e1f3d0b7a8b0c67efb54458641 (diff) | |
download | bionic-b2060b027c9eb2748895b53a0d69d40b52371a4e.zip bionic-b2060b027c9eb2748895b53a0d69d40b52371a4e.tar.gz bionic-b2060b027c9eb2748895b53a0d69d40b52371a4e.tar.bz2 |
FORTIFY_SOURCE: restore __memcpy_chk()
In our previous FORTIFY_SOURCE change, we started using a custom
inline for memcpy(), rather than using GCC's __builtin_memcpy_chk().
This allowed us to delete our copy of __memcpy_chk(), and replace it
by __memcpy_chk2().
Apparently GCC uses __memcpy_chk() outside of __builtin_memcpy_chk().
Specifically, __memcpy_chk() is used by __builtin__memMOVE_chk() under
certain optimization levels.
Keep the old __memcpy_chk() function around, and have it call into
__memcpy_chk2().
Change-Id: I2453930b24b8a492a3b6ed860e18d92a6b762b80
Diffstat (limited to 'libc/string')
-rw-r--r-- | libc/string/__memcpy_chk.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libc/string/__memcpy_chk.c b/libc/string/__memcpy_chk.c index 60fa427..934ed67 100644 --- a/libc/string/__memcpy_chk.c +++ b/libc/string/__memcpy_chk.c @@ -70,3 +70,13 @@ void *__memcpy_chk2(void *dest, const void *src, return memcpy(dest, src, copy_amount); } + +/* + * GCC can create references to __memcpy_chk when using + * __builtin__memmove_chk(). + */ +void *__memcpy_chk(void *dest, const void *src, + size_t copy_amount, size_t dest_len) +{ + return __memcpy_chk2(dest, src, copy_amount, dest_len, (size_t) -1); +} |