projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
72658c6
)
remove redundant condition in memccpy
author
Alexander Monakov
<amonakov@ispras.ru>
Mon, 9 Mar 2020 18:32:16 +0000
(21:32 +0300)
committer
Rich Felker
<dalias@aerifal.cx>
Fri, 20 Mar 2020 19:45:08 +0000
(15:45 -0400)
Commit
d9bdfd164
("fix memccpy to not access buffer past given size")
correctly added a check for 'n' nonzero, but made the pre-existing test
'*s==c' redundant: n!=0 implies *s==c. Remove the unnecessary check.
Reported by Alexey Izbyshev.
src/string/memccpy.c
patch
|
blob
|
history
diff --git
a/src/string/memccpy.c
b/src/string/memccpy.c
index 00c18e2b5b567bbbd51435f058203d1c59bad040..3b0a370020c4d5b80ff32a609e5322b7760f0dc4 100644
(file)
--- 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 (n
&& *s==c
) return d+1;
+ if (n) return d+1;
return 0;
}