Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/net Fix an alignment problem introduced by the patc...



details:   https://anonhg.NetBSD.org/src/rev/74e5b273b776
branches:  trunk
changeset: 486489:74e5b273b776
user:      tron <tron%NetBSD.org@localhost>
date:      Tue May 23 07:03:10 2000 +0000

description:
Fix an alignment problem introduced by the patch for PR lib/8032.
Fixes PR lib/10048 by J.T. Conklin.

diffstat:

 lib/libc/net/gethnamaddr.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (34 lines):

diff -r 57d11788c808 -r 74e5b273b776 lib/libc/net/gethnamaddr.c
--- a/lib/libc/net/gethnamaddr.c        Tue May 23 06:07:42 2000 +0000
+++ b/lib/libc/net/gethnamaddr.c        Tue May 23 07:03:10 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gethnamaddr.c,v 1.32 2000/04/25 13:47:38 itojun Exp $  */
+/*     $NetBSD: gethnamaddr.c,v 1.33 2000/05/23 07:03:10 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.32 2000/04/25 13:47:38 itojun Exp $");
+__RCSID("$NetBSD: gethnamaddr.c,v 1.33 2000/05/23 07:03:10 tron Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -903,13 +903,13 @@
        if (num == 0) return NULL;
 
        len = ptr - tmpbuf;
-       if (len > sizeof(hostbuf)) {
+       if (len > (sizeof(hostbuf) - ALIGNBYTES)) {
                free(tmpbuf);
                errno = ENOSPC;
                h_errno = NETDB_INTERNAL;
                return NULL;
        }
-       ptr = memcpy(hostbuf, tmpbuf, len);
+       ptr = memcpy((void *)ALIGN(hostbuf), tmpbuf, len);
        free(tmpbuf);
 
        host.h_name = ptr;



Home | Main Index | Thread Index | Old Index