fortify-headers

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

commit fd36113966af1df5900e9ef9749ae1f2ff1b0145
parent 2c610a26730540ff917cf83dd9dc5387184001b2
Author: jvoisin <julien.voisin@dustri.org>
Date:   Sat, 26 Aug 2023 23:42:14 +0200

Add two tests for wmemmove

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

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