fortify-headers

standalone fortify-source implementation
git clone git://git.2f30.org/fortify-headers
Log | Files | Refs | README | LICENSE

commit 875b469a6dd588702a4d84a9e8f3f4002a482021
parent 874c40f5bc16819f4ddd0eaa0fc19e9f344a6cc8
Author: jvoisin <julien.voisin@dustri.org>
Date:   Mon, 10 Jul 2023 23:34:34 +0200

Add tests for sys/socket

Diffstat:
Mtests/Makefile | 4++++
Atests/test_FD_CLR_SETSIZE.c | 14++++++++++++++
Atests/test_FD_CLR_negative.c | 14++++++++++++++
Atests/test_FD_SET_SETSIZE.c | 14++++++++++++++
Atests/test_FD_SET_negative.c | 14++++++++++++++
5 files changed, 60 insertions(+), 0 deletions(-)

diff --git a/tests/Makefile b/tests/Makefile @@ -62,6 +62,10 @@ TARGETS= \ test_recvfrom \ test_send \ test_sendto \ + test_FD_CLR_negative \ + test_FD_CLR_SETSIZE \ + test_FD_SET_negative \ + test_FD_SET_SETSIZE \ .SILENT: diff --git a/tests/test_FD_CLR_SETSIZE.c b/tests/test_FD_CLR_SETSIZE.c @@ -0,0 +1,14 @@ +#include "common.h" + +#include <sys/select.h> + +int main(int argc, char** argv) { + fd_set rfds; + + CHK_FAIL_START + FD_CLR(FD_SETSIZE, &rfds); + CHK_FAIL_END + + puts((const char*)&rfds); + return ret; +} diff --git a/tests/test_FD_CLR_negative.c b/tests/test_FD_CLR_negative.c @@ -0,0 +1,14 @@ +#include "common.h" + +#include <sys/select.h> + +int main(int argc, char** argv) { + fd_set rfds; + + CHK_FAIL_START + FD_CLR(-1, &rfds); + CHK_FAIL_END + + puts((const char*)&rfds); + return ret; +} diff --git a/tests/test_FD_SET_SETSIZE.c b/tests/test_FD_SET_SETSIZE.c @@ -0,0 +1,14 @@ +#include "common.h" + +#include <sys/select.h> + +int main(int argc, char** argv) { + fd_set rfds; + + CHK_FAIL_START + FD_SET(FD_SETSIZE, &rfds); + CHK_FAIL_END + + puts((const char*)&rfds); + return ret; +} diff --git a/tests/test_FD_SET_negative.c b/tests/test_FD_SET_negative.c @@ -0,0 +1,14 @@ +#include "common.h" + +#include <sys/select.h> + +int main(int argc, char** argv) { + fd_set rfds; + + CHK_FAIL_START + FD_SET(-1, &rfds); + CHK_FAIL_END + + puts((const char*)&rfds); + return ret; +}