musl - musl - an implementation of the standard library for Linux-based systems

index : musl
musl - an implementation of the standard library for Linux-based systems
summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/string/memccpy.c 2
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;
}
generated by cgit v1.2.1 (git 2.18.0) at 2025年09月15日 14:35:33 +0000

AltStyle によって変換されたページ (->オリジナル) /