From eff00f21c4edbe59f20268af91dc69d710ea9990 Mon Sep 17 00:00:00 2001 From: "K. Lange" Date: Tue, 27 Nov 2018 18:41:50 +0900 Subject: [PATCH] libc: fix strncpy - must set nil bytes --- libc/string/strncpy.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libc/string/strncpy.c b/libc/string/strncpy.c index a665b87d..c991cedc 100644 --- a/libc/string/strncpy.c +++ b/libc/string/strncpy.c @@ -9,5 +9,9 @@ char * strncpy(char * dest, const char * src, size_t n) { ++src; --n; } + for (int i = 0; i < (int)n; ++i) { + *out = '\0'; + ++out; + } return out; }