libc: fix strncpy - must set nil bytes

This commit is contained in:
K. Lange 2018-11-27 18:41:50 +09:00
parent 522cda0456
commit eff00f21c4
1 changed files with 4 additions and 0 deletions

View File

@ -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;
}