Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/mrinfo fix the length argument to a memcpy() to ref...



details:   https://anonhg.NetBSD.org/src/rev/12fdc64e0ed7
branches:  trunk
changeset: 766418:12fdc64e0ed7
user:      mrg <mrg%NetBSD.org@localhost>
date:      Wed Jun 22 04:02:46 2011 +0000

description:
fix the length argument to a memcpy() to refer to the size of the
destination, not the size of the pointer.  real bug on 64 bit platforms.

diffstat:

 usr.sbin/mrinfo/mrinfo.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 2aa5395a9ef9 -r 12fdc64e0ed7 usr.sbin/mrinfo/mrinfo.c
--- a/usr.sbin/mrinfo/mrinfo.c  Wed Jun 22 04:01:33 2011 +0000
+++ b/usr.sbin/mrinfo/mrinfo.c  Wed Jun 22 04:02:46 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mrinfo.c,v 1.27 2009/04/17 14:07:45 lukem Exp $        */
+/*     $NetBSD: mrinfo.c,v 1.28 2011/06/22 04:02:46 mrg Exp $  */
 
 /*
  * This tool requests configuration info from a multicast router
@@ -80,7 +80,7 @@
 static char rcsid[] =
     "@(#) Header: mrinfo.c,v 1.6 93/04/08 15:14:16 van Exp (LBL)";
 #else
-__RCSID("$NetBSD: mrinfo.c,v 1.27 2009/04/17 14:07:45 lukem Exp $");
+__RCSID("$NetBSD: mrinfo.c,v 1.28 2011/06/22 04:02:46 mrg Exp $");
 #endif
 #endif
 
@@ -373,7 +373,7 @@
                hp->h_addr_list[0] = malloc(hp->h_length);
                if (hp->h_addr_list[0] == NULL)
                        logit(LOG_ERR, errno, "malloc");
-               memcpy(hp->h_addr_list[0], &target_addr, sizeof(hp->h_addr_list[0]));
+               memcpy(hp->h_addr_list[0], &target_addr, hp->h_length);
                hp->h_addr_list[1] = NULL;
        } else
                hp = gethostbyname(host);



Home | Main Index | Thread Index | Old Index