scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 4e10af7b640ed86d32998b662f132cc76743b5db
parent 673610fb8b9defeab63b90549251dfc885fa152d
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu, 16 Feb 2017 22:52:31 +0100

[libc] Fix strncpy()

The count must be decremented in the first stage too.

Diffstat:
libc/src/strncpy.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libc/src/strncpy.c b/libc/src/strncpy.c @@ -7,7 +7,7 @@ strncpy(char *dst, const char *src, size_t n) { char *ret = dst; - while (n > 0 && (*dst++ = *src++)) + while (n-- > 0 && (*dst++ = *src++)) /* nothing */; while (n-- > 0) *dst++ = '\0';