summaryrefslogtreecommitdiffstats
path: root/lib/libc/net/gethostbynis.c
diff options
context:
space:
mode:
authorfenner <fenner@FreeBSD.org>2003-01-05 14:05:24 +0000
committerfenner <fenner@FreeBSD.org>2003-01-05 14:05:24 +0000
commitdde73f1de42ddfcd58d5aadeb1e13099afbe1471 (patch)
tree01bf18a1845002800351a576c4624ac80adb545f /lib/libc/net/gethostbynis.c
parent24aad6f8c090ad42fef31182e6e375e27d8bc6d3 (diff)
downloadFreeBSD-src-dde73f1de42ddfcd58d5aadeb1e13099afbe1471.zip
FreeBSD-src-dde73f1de42ddfcd58d5aadeb1e13099afbe1471.tar.gz
Use in_addr_t for the right size of an IPv4 address, and copy into
an unaligned destination using bcopy instead of an assignment. Submitted by: Hartmut Brandt <brandt@fokus.gmd.de> PR: sparc64/46729
Diffstat (limited to 'lib/libc/net/gethostbynis.c')
-rw-r--r--lib/libc/net/gethostbynis.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/net/gethostbynis.c b/lib/libc/net/gethostbynis.c
index ad336fc..73b12ed 100644
--- a/lib/libc/net/gethostbynis.c
+++ b/lib/libc/net/gethostbynis.c
@@ -67,6 +67,7 @@ _gethostbynis(name, map, af)
static struct hostent h;
static char *domain = (char *)NULL;
static char ypbuf[YPMAXRECORD + 2];
+ in_addr_t addr;
switch(af) {
case AF_INET:
@@ -104,7 +105,8 @@ _gethostbynis(name, map, af)
*cp++ = '\0';
h.h_addr_list = host_addrs;
h.h_addr = hostaddr;
- *((u_long *)h.h_addr) = inet_addr(result);
+ addr = inet_addr(result);
+ bcopy((char *)&addr, h.h_addr, size);
h.h_length = size;
h.h_addrtype = AF_INET;
while (*cp == ' ' || *cp == '\t')
OpenPOWER on IntegriCloud