123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- #ifndef _FORTIFY_SYS_SOCKET_H
- #define _FORTIFY_SYS_SOCKET_H
- __extension__
- #include_next <sys/socket.h>
- #if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
- #include "../fortify-headers.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- #undef recv
- #undef recvfrom
- #undef send
- #undef sendto
- _FORTIFY_FN(recv) ssize_t recv(int __f, void *__s, size_t __n, int __fl)
- {
- size_t __b = __builtin_object_size(__s, 0);
- if (__n > __b)
- __builtin_trap();
- return __orig_recv(__f, __s, __n, __fl);
- }
- _FORTIFY_FN(recvfrom) ssize_t recvfrom(int __f, void *__s, size_t __n, int __fl,
- struct sockaddr *__a, socklen_t *__l)
- {
- size_t __b = __builtin_object_size(__s, 0);
- if (__n > __b)
- __builtin_trap();
- return __orig_recvfrom(__f, __s, __n, __fl, __a, __l);
- }
- _FORTIFY_FN(send) ssize_t send(int __f, const void *__s, size_t __n, int __fl)
- {
- size_t __b = __builtin_object_size(__s, 0);
- if (__n > __b)
- __builtin_trap();
- return __orig_send(__f, __s, __n, __fl);
- }
- _FORTIFY_FN(sendto) ssize_t sendto(int __f, const void *__s, size_t __n, int __fl,
- const struct sockaddr *__a, socklen_t __l)
- {
- size_t __b = __builtin_object_size(__s, 0);
- if (__n > __b)
- __builtin_trap();
- return __orig_sendto(__f, __s, __n, __fl, __a, __l);
- }
- #ifdef __cplusplus
- }
- #endif
- #endif
- #endif
|