summaryrefslogtreecommitdiffstats
path: root/freebsd/lib/libc/net/map_v4v6.c
diff options
context:
space:
mode:
Diffstat (limited to 'freebsd/lib/libc/net/map_v4v6.c')
-rw-r--r--freebsd/lib/libc/net/map_v4v6.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/freebsd/lib/libc/net/map_v4v6.c b/freebsd/lib/libc/net/map_v4v6.c
index e2fc9747..2923fb48 100644
--- a/freebsd/lib/libc/net/map_v4v6.c
+++ b/freebsd/lib/libc/net/map_v4v6.c
@@ -57,7 +57,6 @@ static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93";
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <sys/types.h>
#include <rtems/bsd/sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
@@ -70,6 +69,7 @@ __FBSDID("$FreeBSD$");
#include <resolv.h>
#include <ctype.h>
#include <syslog.h>
+#include "netdb_private.h"
typedef union {
int32_t al;
@@ -79,19 +79,11 @@ typedef union {
void
_map_v4v6_address(const char *src, char *dst)
{
- u_char *p = (u_char *)dst;
- char tmp[NS_INADDRSZ];
- int i;
-
- /* 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. */
- for (i = 0; i < 10; i++)
- *p++ = 0x00;
- *p++ = 0xff;
- *p++ = 0xff;
- /* Retrieve the saved copy and we're done. */
- memcpy((void*)p, tmp, NS_INADDRSZ);
+ memset(&dst[10], 0xff, 2);
+ memset(&dst[0], 0, 10);
}
void