ref: bbc024de5b24bf1956e100b890c3d42666f55374
parent: ef8d13b810f3c48c78b6d3ef121872becee05d28
author: Roberto E. Vargas Caballero <[email protected]>
date: Thu Feb 16 17:52:31 EST 2017
[libc] Fix strncpy() The count must be decremented in the first stage too.
--- a/libc/src/strncpy.c
+++ b/libc/src/strncpy.c
@@ -7,7 +7,7 @@
{
char *ret = dst;
- while (n > 0 && (*dst++ = *src++))
+ while (n-- > 0 && (*dst++ = *src++))
/* nothing */;
while (n-- > 0)
*dst++ = '\0';