fortify-headers

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

commit 874c40f5bc16819f4ddd0eaa0fc19e9f344a6cc8
parent 106785b6bba515566637a028a602061fdef1e184
Author: jvoisin <julien.voisin@dustri.org>
Date:   Mon, 10 Jul 2023 23:20:32 +0200

Add tests for sys/socket.h

Diffstat:
Mtests/Makefile | 4++++
Atests/test_recv.c | 14++++++++++++++
Atests/test_recvfrom.c | 14++++++++++++++
Atests/test_send.c | 14++++++++++++++
Atests/test_sendto.c | 14++++++++++++++
5 files changed, 60 insertions(+), 0 deletions(-)

diff --git a/tests/Makefile b/tests/Makefile @@ -58,6 +58,10 @@ TARGETS= \ test_vsnprintf \ test_vsprintf \ test_malloc \ + test_recv \ + test_recvfrom \ + test_send \ + test_sendto \ .SILENT: diff --git a/tests/test_recv.c b/tests/test_recv.c @@ -0,0 +1,14 @@ +#include "common.h" + +#include <sys/socket.h> + +int main(int argc, char** argv) { + char buffer[12] = {0}; + + CHK_FAIL_START + recv(0, buffer, 14, 0); + CHK_FAIL_END + + puts(buffer); + return ret; +} diff --git a/tests/test_recvfrom.c b/tests/test_recvfrom.c @@ -0,0 +1,14 @@ +#include "common.h" + +#include <sys/socket.h> + +int main(int argc, char** argv) { + char buffer[12] = {0}; + + CHK_FAIL_START + recvfrom(0, buffer, 14, 0, NULL, NULL); + CHK_FAIL_END + + puts(buffer); + return ret; +} diff --git a/tests/test_send.c b/tests/test_send.c @@ -0,0 +1,14 @@ +#include "common.h" + +#include <sys/socket.h> + +int main(int argc, char** argv) { + char buffer[12] = {0}; + + CHK_FAIL_START + send(0, buffer, 14, 0); + CHK_FAIL_END + + puts(buffer); + return ret; +} diff --git a/tests/test_sendto.c b/tests/test_sendto.c @@ -0,0 +1,14 @@ +#include "common.h" + +#include <sys/socket.h> + +int main(int argc, char** argv) { + char buffer[12] = {0}; + + CHK_FAIL_START + sendto(0, buffer, 14, 0, NULL, 0); + CHK_FAIL_END + + puts(buffer); + return ret; +}