X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fnetwork%2Finet_ntop.c;h=4bfef2c557ab4478afeb5c22f5d548fd69e51d3c;hb=6aeb9c6703670649ee09b3c8575fb428168bb75c;hp=e9e2823f44f0299ec35417ea6253c16cf45f362e;hpb=1cd417bdf10366d63cc875e285c6418709a58c17;p=musl diff --git a/src/network/inet_ntop.c b/src/network/inet_ntop.c index e9e2823f..4bfef2c5 100644 --- a/src/network/inet_ntop.c +++ b/src/network/inet_ntop.c @@ -1,7 +1,5 @@ #include -#include #include -#include #include #include #include @@ -38,9 +36,9 @@ const char *inet_ntop(int af, const void *restrict a0, char *restrict s, socklen j = strspn(buf+i, ":0"); if (j>max) best=i, max=j; } - if (max>2) { + if (max>3) { 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);