Skip to content

Commit

Permalink
libc: add __wcsncpy_chk() to support python 3.10
Browse files Browse the repository at this point in the history
Signed-off-by: Waldemar Kozaczuk <[email protected]>
  • Loading branch information
wkozaczuk committed Nov 7, 2022
1 parent c068149 commit 6fd4a65
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions libc/string/__wcsncpy_chk.c
Original file line number Diff line number Diff line change
@@ -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);
}

0 comments on commit 6fd4a65

Please sign in to comment.