OSDN Git Service

libc: fix typo in __RENAME macro
authorGeorge Burgess IV <gbiv@google.com>
Wed, 19 Apr 2017 01:28:19 +0000 (18:28 -0700)
committerElliott Hughes <enh@google.com>
Wed, 19 Apr 2017 20:38:52 +0000 (13:38 -0700)
Apparently __strncpy_real redirects to strcpy instead of strncpy for GCC
builds. This is bad, and it confused a project compiled by GCC that uses
strcpy.

I audited all of the FORTIFY-related __RENAMEs both manually and with a
script I hacked together; they all look correct aside from this one.

FWIW, with the cleaned up clang FORTIFY, lots of the `void foo()
__RENAME(foo)` will just become `void foo()` if this last thing I'm
working on gets through review.

Bug: 35329524
Test: Previously broken project now seems to work. Bullhead and Ryu
both build + boot.

(cherry picked from commit 31e5a35f3d403ffa4ffe0215f9664d08fb749ada)

Change-Id: I790a42f2cf2f7b8e003faa4df9135db22a2e20db

libc/include/string.h

index 26bd93f..1c5357f 100644 (file)
@@ -418,7 +418,7 @@ void* memset(void* _Nonnull s, int c, size_t n) __overloadable
 #undef __error_zero_size
 #undef __error_if_overflows_dst
 #else // defined(__clang__)
-extern char* __strncpy_real(char* __restrict, const char*, size_t) __RENAME(strcpy);
+extern char* __strncpy_real(char* __restrict, const char*, size_t) __RENAME(strncpy);
 extern void* __memrchr_real(const void*, int, size_t) __RENAME(memrchr);
 extern size_t __strlcpy_real(char* __restrict, const char* __restrict, size_t)
     __RENAME(strlcpy);