fortify-headers

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

commit 1403ff93afcdd3fea2d18a05b73a9dd11c81a21f
parent f12211f366dfd0447fdcd8ec922547c1821a0ad2
Author: jvoisin <julien.voisin@dustri.org>
Date:   Mon,  4 Sep 2023 01:46:59 +0200

Add tests for wmemcpy

Diffstat:
Mtests/Makefile | 2++
Atests/test_wmemcpy_dynamic_write.c | 14++++++++++++++
Atests/test_wmemcpy_static_write.c | 14++++++++++++++
3 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/tests/Makefile b/tests/Makefile @@ -104,6 +104,8 @@ TARGETS= \ test_write_dynamic \ test_wmemmove_dynamic_write \ test_wmemmove_static_write \ + test_wmemcpy_dynamic_write \ + test_wmemcpy_static_write \ test_write_static \ .SILENT: diff --git a/tests/test_wmemcpy_dynamic_write.c b/tests/test_wmemcpy_dynamic_write.c @@ -0,0 +1,14 @@ +#include "common.h" + +#include <wchar.h> + +int main(int argc, char** argv) { + wchar_t buffer[2] = {0}; + wmemcpy(buffer, L"αβγδεζηθικλμνξοπρστυφχψω", 2); + + CHK_FAIL_START + wmemcpy(buffer, L"αβγδεζηθικλμνξοπρστυφχψω", argc); + CHK_FAIL_END + + return ret; +} diff --git a/tests/test_wmemcpy_static_write.c b/tests/test_wmemcpy_static_write.c @@ -0,0 +1,14 @@ +#include "common.h" + +#include <wchar.h> + +int main(int argc, char** argv) { + wchar_t buffer[2] = {0}; + wmemcpy(buffer, L"αβγδεζηθικλμνξοπρστυφχψω", 2); + + CHK_FAIL_START + wmemcpy(buffer, L"αβγδεζηθικλμνξοπρστυφχψω", 1337); + CHK_FAIL_END + + return ret; +}