Fix strntoul implementation in libkern
MODIFY
include/sys/libkern.h
include/sys/libkern.h
@@ -68,6 +68,7 @@ size_t strlcat(char *dst, const char *src, size_t dsize);
size_t strlcpy(char *dst, const char *src, size_t dsize);
size_t strlen(const char *str);
int strncmp(const char *s1, const char *s2, size_t n);
+char *strncpy(char *dst, const char *src, size_t n);
size_t strnlen(const char *str, size_t maxlen);
char *strrchr(const char *s, int c);
char *strsep(char **stringp, const char *delim);

MODIFY
sys/libkern/stdlib/strtoul.c
sys/libkern/stdlib/strtoul.c
@@ -99,6 +99,7 @@ unsigned long strtoul(const char *nptr, char **endptr, int base) {
unsigned long strntoul(const char *nptr, size_t len, char **endptr, int base) {
char copy[len + 1];
- strlcpy(copy, nptr, len + 1);
+ strncpy(copy, nptr, len);
+ copy[len] = 0;
return strtoul(copy, endptr, base);
}

MODIFY
sys/libkern/string/Makefile
sys/libkern/string/Makefile
@@ -19,6 +19,7 @@ SOURCES = bcopy.S \
strlcat.c \
strlcpy.c \
strncmp.c \
+ strncpy.c \
strnlen.c \
strrchr.c \
strsep.c \

Fix strntoul implementation in libkern (#640)