Don't obliterate the whole message, preserve the data we have just written

and only zero out the rest.
This commit is contained in:
christos 2008-06-01 22:05:47 +00:00
parent c3e93e738f
commit 5d9f99db06

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtsock.c,v 1.106 2008/05/29 17:53:01 christos Exp $ */
/* $NetBSD: rtsock.c,v 1.107 2008/06/01 22:05:47 christos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.106 2008/05/29 17:53:01 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.107 2008/06/01 22:05:47 christos Exp $");
#include "opt_inet.h"
@ -585,8 +585,9 @@ rt_msg1(int type, struct rt_addrinfo *rtinfo, void *data, int datalen)
}
m->m_pkthdr.rcvif = NULL;
m_copyback(m, 0, datalen, data);
if (len > datalen)
(void)memset(mtod(m, char *) + datalen, 0, len - datalen);
rtm = mtod(m, struct rt_msghdr *);
(void)memset(rtm, 0, len);
for (i = 0; i < RTAX_MAX; i++) {
if ((sa = rtinfo->rti_info[i]) == NULL)
continue;