Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com> --- Makefile | 1 + libc/string/__wcsncpy_chk.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 libc/string/__wcsncpy_chk.c
diff --git a/Makefile b/Makefile index fcc55e29..b8d5d924 100644 --- a/Makefile +++ b/Makefile @@ -1796,6 +1796,7 @@ musl += string/wcsncasecmp_l.o musl += string/wcsncat.o musl += string/wcsncmp.o musl += string/wcsncpy.o +libc += string/__wcsncpy_chk.o musl += string/wcsnlen.o musl += string/wcspbrk.o musl += string/wcsrchr.o diff --git a/libc/string/__wcsncpy_chk.c b/libc/string/__wcsncpy_chk.c new file mode 100644 index 00000000..ff3da7f5 --- /dev/null +++ b/libc/string/__wcsncpy_chk.c @@ -0,0 +1,15 @@ +/* + * Copyright (C) 2022 Waldemar Kozaczuk + * + * This work is open source software, licensed under the terms of the + * BSD license as described in the LICENSE file in the top-level directory. + */ + +#include <wchar.h> +#include <assert.h> + +wchar_t *__wcsncpy_chk(wchar_t * dest, const wchar_t * src, size_t n, size_t destlen) +{ + assert(wcslen(src) + sizeof(L'\0') <= destlen); + return wcsncpy(dest, src, n); +} -- 2.35.1 -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to osv-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/osv-dev/20221107152837.142732-1-jwkozaczuk%40gmail.com.