diff options
-rw-r--r-- | libc/include/bits/fortify/socket.h | 11 | ||||
-rw-r--r-- | libc/include/bits/fortify/stat.h | 5 | ||||
-rw-r--r-- | libc/include/bits/fortify/stdlib.h | 6 |
3 files changed, 7 insertions, 15 deletions
diff --git a/libc/include/bits/fortify/socket.h b/libc/include/bits/fortify/socket.h index c1a85c6f9..c9387c050 100644 --- a/libc/include/bits/fortify/socket.h +++ b/libc/include/bits/fortify/socket.h @@ -37,14 +37,12 @@ ssize_t __recvfrom_chk(int, void*, size_t, size_t, int, struct sockaddr*, #if defined(__BIONIC_FORTIFY) -#define __recvfrom_bad_size "'recvfrom' called with size bigger than buffer" -#define __sendto_bad_size "'sendto' called with size bigger than buffer" - #if __ANDROID_API__ >= __ANDROID_API_N__ __BIONIC_FORTIFY_INLINE ssize_t recvfrom(int fd, void* const buf __pass_object_size0, size_t len, int flags, struct sockaddr* src_addr, socklen_t* addr_len) __overloadable - __clang_error_if(__bos_unevaluated_lt(__bos0(buf), len), __recvfrom_bad_size) { + __clang_error_if(__bos_unevaluated_lt(__bos0(buf), len), + "'recvfrom' called with size bigger than buffer") { size_t bos = __bos0(buf); if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) { @@ -58,7 +56,8 @@ ssize_t recvfrom(int fd, void* const buf __pass_object_size0, size_t len, int fl __BIONIC_FORTIFY_INLINE ssize_t sendto(int fd, const void* const buf __pass_object_size0, size_t len, int flags, const struct sockaddr* dest_addr, socklen_t addr_len) __overloadable - __clang_error_if(__bos_unevaluated_lt(__bos0(buf), len), __sendto_bad_size) { + __clang_error_if(__bos_unevaluated_lt(__bos0(buf), len), + "'sendto' called with size bigger than buffer") { size_t bos = __bos0(buf); if (bos == __BIONIC_FORTIFY_UNKNOWN_SIZE) { @@ -84,6 +83,4 @@ ssize_t send(int socket, const void* const buf __pass_object_size0, size_t len, return sendto(socket, buf, len, flags, NULL, 0); } -#undef __recvfrom_bad_size -#undef __sendto_bad_size #endif /* __BIONIC_FORTIFY */ diff --git a/libc/include/bits/fortify/stat.h b/libc/include/bits/fortify/stat.h index b248aca90..30c836264 100644 --- a/libc/include/bits/fortify/stat.h +++ b/libc/include/bits/fortify/stat.h @@ -33,7 +33,6 @@ mode_t __umask_chk(mode_t) __INTRODUCED_IN(18); #if defined(__BIONIC_FORTIFY) -#define __umask_invalid_mode_str "'umask' called with invalid mode" #if __ANDROID_API__ >= __ANDROID_API_J_MR2__ /* Abuse enable_if to make this an overload of umask. */ @@ -41,11 +40,9 @@ __BIONIC_FORTIFY_INLINE mode_t umask(mode_t mode) __overloadable __enable_if(1, "") - __clang_error_if(mode & ~0777, __umask_invalid_mode_str) { + __clang_error_if(mode & ~0777, "'umask' called with invalid mode") { return __umask_chk(mode); } #endif /* __ANDROID_API__ >= __ANDROID_API_J_MR2__ */ -#undef __umask_invalid_mode_str - #endif /* defined(__BIONIC_FORTIFY) */ diff --git a/libc/include/bits/fortify/stdlib.h b/libc/include/bits/fortify/stdlib.h index eff909f93..0bb3d0d66 100644 --- a/libc/include/bits/fortify/stdlib.h +++ b/libc/include/bits/fortify/stdlib.h @@ -31,18 +31,16 @@ #endif #if defined(__BIONIC_FORTIFY) -#define __realpath_buf_too_small_str \ - "'realpath' output parameter must be NULL or a pointer to a buffer with >= PATH_MAX bytes" /* PATH_MAX is unavailable without polluting the namespace, but it's always 4096 on Linux */ #define __PATH_MAX 4096 char* realpath(const char* path, char* resolved) __clang_error_if(__bos_unevaluated_lt(__bos(resolved), __PATH_MAX), - __realpath_buf_too_small_str) + "'realpath' output parameter must be NULL or a pointer to a buffer " + "with >= PATH_MAX bytes") __clang_error_if(!path, "'realpath': NULL path is never correct; flipped arguments?"); /* No need for a definition; the only issues we can catch are at compile-time. */ #undef __PATH_MAX -#undef __realpath_buf_too_small_str #endif /* defined(__BIONIC_FORTIFY) */ |