mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
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.
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user