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:
1cd417b
)
fix undefined strcpy call in inet_ntop
author
Rich Felker
<dalias@aerifal.cx>
Thu, 25 Jul 2013 07:30:24 +0000
(
03:30
-0400)
committer
Rich Felker
<dalias@aerifal.cx>
Thu, 25 Jul 2013 07:30:24 +0000
(
03:30
-0400)
source and dest arguments for strcpy cannot overlap, so memmove must
be used here. the length is already known from the above loop.
src/network/inet_ntop.c
patch
|
blob
|
history
diff --git
a/src/network/inet_ntop.c
b/src/network/inet_ntop.c
index e9e2823f44f0299ec35417ea6253c16cf45f362e..ca3334375128e086bcd49ec6e7c941de769d4ec8 100644
(file)
--- a/
src/network/inet_ntop.c
+++ b/
src/network/inet_ntop.c
@@
-40,7
+40,7
@@
const char *inet_ntop(int af, const void *restrict a0, char *restrict s, socklen
}
if (max>2) {
buf[best] = buf[best+1] = ':';
-
strcpy(buf+best+2, buf+best+max
);
+
memmove(buf+best+2, buf+best+max, i-best-max+1
);
}
if (strlen(buf) < l) {
strcpy(s, buf);