aboutsummaryrefslogtreecommitdiff
path: root/resolv/mapv4v6addr.h
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-07-31 13:33:18 +0000
committerJakub Jelinek <jakub@redhat.com>2007-07-31 13:33:18 +0000
commit32c075e1f01849e161724bbd400ba77244e482cc (patch)
tree5f083a3f352104f32bb6c902d57fa3f294bd8d4d /resolv/mapv4v6addr.h
parentd6220e9ee38c1c9285221b023346201ec5f511b3 (diff)
downloadglibc-32c075e1f01849e161724bbd400ba77244e482cc.zip
glibc-32c075e1f01849e161724bbd400ba77244e482cc.tar.gz
glibc-32c075e1f01849e161724bbd400ba77244e482cc.tar.bz2
.
Diffstat (limited to 'resolv/mapv4v6addr.h')
-rw-r--r--resolv/mapv4v6addr.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/resolv/mapv4v6addr.h b/resolv/mapv4v6addr.h
index 7f85f7d..bc3290f 100644
--- a/resolv/mapv4v6addr.h
+++ b/resolv/mapv4v6addr.h
@@ -56,14 +56,16 @@ static void
map_v4v6_address (const char *src, char *dst)
{
u_char *p = (u_char *) dst;
+ char tmp[INADDRSZ];
int i;
- /* Move the IPv4 part to the right position. */
- memcpy (dst + 12, src, INADDRSZ);
-
+ /* Stash a temporary copy so our caller can update in place. */
+ memcpy (tmp, src, INADDRSZ);
/* Mark this ipv6 addr as a mapped ipv4. */
for (i = 0; i < 10; i++)
*p++ = 0x00;
*p++ = 0xff;
- *p = 0xff;
+ *p++ = 0xff;
+ /* Retrieve the saved copy and we're done. */
+ memcpy ((void *) p, tmp, INADDRSZ);
}