am 4e3ed44d
: Merge "cdefs.h: introduce __bos0"
* commit '4e3ed44db1200ca810842b0667e7fc80125de28d': cdefs.h: introduce __bos0
This commit is contained in:
commit
89dcc10c32
2 changed files with 13 additions and 4 deletions
|
@ -94,8 +94,8 @@ __BIONIC_FORTIFY_INLINE
|
|||
void* memcpy(void* __restrict dest, const void* __restrict src, size_t copy_amount) {
|
||||
char *d = (char *) dest;
|
||||
const char *s = (const char *) src;
|
||||
size_t s_len = __builtin_object_size(s, 0);
|
||||
size_t d_len = __builtin_object_size(d, 0);
|
||||
size_t s_len = __bos0(s);
|
||||
size_t d_len = __bos0(d);
|
||||
|
||||
if (__builtin_constant_p(copy_amount) && (copy_amount > d_len)) {
|
||||
__memcpy_dest_size_error();
|
||||
|
@ -110,7 +110,7 @@ void* memcpy(void* __restrict dest, const void* __restrict src, size_t copy_amou
|
|||
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
void* memmove(void *dest, const void *src, size_t len) {
|
||||
return __builtin___memmove_chk(dest, src, len, __builtin_object_size (dest, 0));
|
||||
return __builtin___memmove_chk(dest, src, len, __bos0(dest));
|
||||
}
|
||||
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
|
@ -153,7 +153,7 @@ char *strncat(char* __restrict dest, const char* __restrict src, size_t n) {
|
|||
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
void* memset(void *s, int c, size_t n) {
|
||||
return __builtin___memset_chk(s, c, n, __builtin_object_size (s, 0));
|
||||
return __builtin___memset_chk(s, c, n, __bos0(s));
|
||||
}
|
||||
|
||||
extern size_t __strlcpy_real(char* __restrict, const char* __restrict, size_t)
|
||||
|
|
|
@ -526,6 +526,14 @@
|
|||
#define __BIONIC__ 1
|
||||
#include <android/api-level.h>
|
||||
|
||||
/*
|
||||
* When _FORTIFY_SOURCE is defined, automatic bounds checking is
|
||||
* added to commonly used libc functions. If a buffer overrun is
|
||||
* detected, the program is safely aborted.
|
||||
*
|
||||
* See
|
||||
* http://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html for details.
|
||||
*/
|
||||
#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
|
||||
#define __BIONIC_FORTIFY 1
|
||||
#if _FORTIFY_SOURCE == 2
|
||||
|
@ -533,6 +541,7 @@
|
|||
#else
|
||||
#define __bos(s) __builtin_object_size((s), 0)
|
||||
#endif
|
||||
#define __bos0(s) __builtin_object_size((s), 0)
|
||||
|
||||
#define __BIONIC_FORTIFY_INLINE \
|
||||
extern inline \
|
||||
|
|
Loading…
Reference in a new issue