diff options
author | Rich Felker <dalias@aerifal.cx> | 2013-07-25 03:30:24 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2013-07-25 03:30:24 -0400 |
commit | f9dd79c8d191a8a5356d146c7ccf956677fea4e9 (patch) | |
tree | 92eaf4837f391bd1c6f0e085f65c0606eea669d3 | |
parent | 1cd417bdf10366d63cc875e285c6418709a58c17 (diff) | |
download | musl-f9dd79c8d191a8a5356d146c7ccf956677fea4e9.tar.gz musl-f9dd79c8d191a8a5356d146c7ccf956677fea4e9.tar.xz musl-f9dd79c8d191a8a5356d146c7ccf956677fea4e9.zip |
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.
-rw-r--r-- | src/network/inet_ntop.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/network/inet_ntop.c b/src/network/inet_ntop.c index e9e2823f..ca333437 100644 --- 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); |