summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJulien Voisin2023-11-16 15:46:10 +0000
committerGitHub2023-11-16 15:46:10 +0000
commit7e6100d98005d1c125441915aaba1bfc6b5166fd (patch)
tree2d0f2395dfd51d7b2810b7be3e549176b8a6c736 /include
parentcfdcaf72ca60db28ad8a7240a5a09e99151cab24 (diff)
parent52ec4848225a0e9f577272015ced52c45923d4ba (diff)
Add hardening for select()
Diffstat (limited to 'include')
-rw-r--r--include/sys/select.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/sys/select.h b/include/sys/select.h
index 29819be..f1cefee 100644
--- a/include/sys/select.h
+++ b/include/sys/select.h
@@ -67,6 +67,18 @@ _STI int __fortify_FD_ISSET(int __f, fd_set * _FORTIFY_POS0 __s)
67#undef FD_ISSET 67#undef FD_ISSET
68#define FD_ISSET(fd, set) __fortify_FD_ISSET(fd, set) 68#define FD_ISSET(fd, set) __fortify_FD_ISSET(fd, set)
69 69
70#ifndef __clang__
71#undef select
72_FORTIFY_FN(select) int select(int nfds, fd_set* readfds,
73 fd_set* writefds,
74 fd_set* exceptfds,
75 struct timeval *timeout){
76 if (nfds > FD_SETSIZE + 1)
77 __builtin_trap();
78 return __orig_select(nfds, readfds, writefds, exceptfds, timeout);
79}
80#endif
81
70#ifdef __cplusplus 82#ifdef __cplusplus
71} 83}
72#endif 84#endif