From: Waldemar Kozaczuk <jwkozac...@gmail.com>
Committer: Waldemar Kozaczuk <jwkozac...@gmail.com>
Branch: master

libc: add __wcsncpy_chk() to support python 3.10

Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com>

---
diff --git a/Makefile b/Makefile
--- 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
--- a/libc/string/__wcsncpy_chk.c
+++ 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);
+}

-- 
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/0000000000004cf87c05ecf67639%40google.com.

Reply via email to