summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2015-12-22 12:01:06 +0000
committerume <ume@FreeBSD.org>2015-12-22 12:01:06 +0000
commitd7802dffd4ee6ac735089a2386db94f2f89a5ebb (patch)
treebb79fb0d455c7815cb7cea598df18ab49bf6529a
parentc3f11e9f0e23d1aba656d9436d9709e39698a87e (diff)
downloadFreeBSD-src-d7802dffd4ee6ac735089a2386db94f2f89a5ebb.zip
FreeBSD-src-d7802dffd4ee6ac735089a2386db94f2f89a5ebb.tar.gz
We don't need to use a temporary buffer, here.
MFC after: 1 week
-rw-r--r--lib/libc/net/map_v4v6.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/libc/net/map_v4v6.c b/lib/libc/net/map_v4v6.c
index 5cfe817..327d6b4 100644
--- a/lib/libc/net/map_v4v6.c
+++ b/lib/libc/net/map_v4v6.c
@@ -78,15 +78,11 @@ typedef union {
void
_map_v4v6_address(const char *src, char *dst)
{
- char tmp[NS_INADDRSZ];
-
- /* Stash a temporary copy so our caller can update in place. */
- memcpy(tmp, src, NS_INADDRSZ);
+ /* Our caller may update in place. */
+ memmove(&dst[12], src, NS_INADDRSZ);
/* Mark this ipv6 addr as a mapped ipv4. */
- memset(&dst[0], 0, 10);
memset(&dst[10], 0xff, 2);
- /* Retrieve the saved copy and we're done. */
- memcpy(&dst[12], tmp, NS_INADDRSZ);
+ memset(&dst[0], 0, 10);
}
void
OpenPOWER on IntegriCloud