]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - resolv/mapv4v6addr.h
[BZ #2510, BZ #2830, BZ #3137, BZ #3313, BZ #3426, BZ #3465, BZ #3480, BZ #3483,...
[thirdparty/glibc.git] / resolv / mapv4v6addr.h
index bc3290f1627e02b6a398603436c3ae7cfad874ba..7f85f7d5e393ec5f2944abcef13a623b801eb9f0 100644 (file)
@@ -56,16 +56,14 @@ static void
 map_v4v6_address (const char *src, char *dst)
 {
   u_char *p = (u_char *) dst;
-  char tmp[INADDRSZ];
   int i;
 
-  /* Stash a temporary copy so our caller can update in place. */
-  memcpy (tmp, src, INADDRSZ);
+  /* Move the IPv4 part to the right position.  */
+  memcpy (dst + 12, src, INADDRSZ);
+
   /* Mark this ipv6 addr as a mapped ipv4. */
   for (i = 0; i < 10; i++)
     *p++ = 0x00;
   *p++ = 0xff;
-  *p++ = 0xff;
-  /* Retrieve the saved copy and we're done. */
-  memcpy ((void *) p, tmp, INADDRSZ);
+  *p = 0xff;
 }