Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/net Make sure that "h_addr_list" pointers are longw...
details: https://anonhg.NetBSD.org/src/rev/ae263260c37d
branches: trunk
changeset: 474767:ae263260c37d
user: tron <tron%NetBSD.org@localhost>
date: Mon Jul 19 17:43:59 1999 +0000
description:
Make sure that "h_addr_list" pointers are longword aligned because some
broken applications depend on it. Fixes PR lib/8032 by David K Brownlee.
diffstat:
lib/libc/net/gethnamaddr.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diffs (45 lines):
diff -r 943ac0499962 -r ae263260c37d lib/libc/net/gethnamaddr.c
--- a/lib/libc/net/gethnamaddr.c Mon Jul 19 15:49:39 1999 +0000
+++ b/lib/libc/net/gethnamaddr.c Mon Jul 19 17:43:59 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gethnamaddr.c,v 1.21 1999/07/06 02:00:41 itojun Exp $ */
+/* $NetBSD: gethnamaddr.c,v 1.22 1999/07/19 17:43:59 tron Exp $ */
/*
* ++Copyright++ 1985, 1988, 1993
@@ -61,7 +61,7 @@
static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93";
static char rcsid[] = "Id: gethnamaddr.c,v 8.21 1997/06/01 20:34:37 vixie Exp ";
#else
-__RCSID("$NetBSD: gethnamaddr.c,v 1.21 1999/07/06 02:00:41 itojun Exp $");
+__RCSID("$NetBSD: gethnamaddr.c,v 1.22 1999/07/19 17:43:59 tron Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -818,7 +818,8 @@
register char *src;
bufsize = strlen(p->h_name) + 2 +
- MAXADDRS * p->h_length;
+ MAXADDRS * p->h_length +
+ ALIGNBYTES;
for (cp = p->h_aliases; *cp != NULL; cp++)
bufsize += strlen(*cp) + 1;
@@ -835,6 +836,8 @@
while ((*ptr++ = *src++) != '\0');
}
*ptr++ = '\0';
+
+ ptr = (char *)ALIGN(ptr);
}
(void)memcpy(ptr, p->h_addr_list[0], (size_t)p->h_length);
@@ -865,6 +868,7 @@
ptr++;
*cp = NULL;
+ ptr = (char *)ALIGN(ptr);
cp = h_addr_ptrs;
while (num--) {
*cp++ = ptr;
Home |
Main Index |
Thread Index |
Old Index