From f9de8bfe1a731c309b91d175b4f6f4aeb786effa Mon Sep 17 00:00:00 2001 From: Siddhesh Poyarekar Date: Tue, 15 Dec 2020 23:50:09 +0530 Subject: nonstring: Enable __FORTIFY_LEVEL=3 Use __builtin_dynamic_object_size in the remaining functions that don't have compiler builtins as is the case for string functions. --- socket/bits/socket2.h | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'socket') diff --git a/socket/bits/socket2.h b/socket/bits/socket2.h index c0421ce..05418ba 100644 --- a/socket/bits/socket2.h +++ b/socket/bits/socket2.h @@ -33,13 +33,15 @@ extern ssize_t __REDIRECT (__recv_chk_warn, __fortify_function ssize_t recv (int __fd, void *__buf, size_t __n, int __flags) { - if (__bos0 (__buf) != (size_t) -1) + if (__glibc_objsize0 (__buf) != (size_t) -1) { if (!__builtin_constant_p (__n)) - return __recv_chk (__fd, __buf, __n, __bos0 (__buf), __flags); + return __recv_chk (__fd, __buf, __n, __glibc_objsize0 (__buf), + __flags); - if (__n > __bos0 (__buf)) - return __recv_chk_warn (__fd, __buf, __n, __bos0 (__buf), __flags); + if (__n > __glibc_objsize0 (__buf)) + return __recv_chk_warn (__fd, __buf, __n, __glibc_objsize0 (__buf), + __flags); } return __recv_alias (__fd, __buf, __n, __flags); } @@ -64,14 +66,14 @@ __fortify_function ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n, int __flags, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len) { - if (__bos0 (__buf) != (size_t) -1) + if (__glibc_objsize0 (__buf) != (size_t) -1) { if (!__builtin_constant_p (__n)) - return __recvfrom_chk (__fd, __buf, __n, __bos0 (__buf), __flags, - __addr, __addr_len); - if (__n > __bos0 (__buf)) - return __recvfrom_chk_warn (__fd, __buf, __n, __bos0 (__buf), __flags, - __addr, __addr_len); + return __recvfrom_chk (__fd, __buf, __n, __glibc_objsize0 (__buf), + __flags, __addr, __addr_len); + if (__n > __glibc_objsize0 (__buf)) + return __recvfrom_chk_warn (__fd, __buf, __n, __glibc_objsize0 (__buf), + __flags, __addr, __addr_len); } return __recvfrom_alias (__fd, __buf, __n, __flags, __addr, __addr_len); } -- cgit v1.1