mirror of
https://github.com/fluencelabs/musl
synced 2025-04-25 07:12:15 +00:00
fix undefined strcpy call in inet_ntop
source and dest arguments for strcpy cannot overlap, so memmove must be used here. the length is already known from the above loop.
This commit is contained in:
parent
1cd417bdf1
commit
f9dd79c8d1
@ -40,7 +40,7 @@ const char *inet_ntop(int af, const void *restrict a0, char *restrict s, socklen
|
|||||||
}
|
}
|
||||||
if (max>2) {
|
if (max>2) {
|
||||||
buf[best] = buf[best+1] = ':';
|
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) {
|
if (strlen(buf) < l) {
|
||||||
strcpy(s, buf);
|
strcpy(s, buf);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user