about summary refs log tree commit diff
path: root/src/string/memccpy.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/string/memccpy.c')
-rw-r--r--src/string/memccpy.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/string/memccpy.c b/src/string/memccpy.c
index f515581c..00c18e2b 100644
--- a/src/string/memccpy.c
+++ b/src/string/memccpy.c
@@ -29,6 +29,6 @@ void *memccpy(void *restrict dest, const void *restrict src, int c, size_t n)
 #endif
 	for (; n && (*d=*s)!=c; n--, s++, d++);
 tail:
-	if (*s==c) return d+1;
+	if (n && *s==c) return d+1;
 	return 0;
 }