Zero out the NIC memory when padding packet to ETHER_MIN_LEN-ETHER_CRC_LEN

This commit is contained in:
bouyer 2003-01-15 22:00:43 +00:00
parent 4199421246
commit ba7f2ad41b
2 changed files with 9 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_eg.c,v 1.60 2002/10/02 03:10:47 thorpej Exp $ */
/* $NetBSD: if_eg.c,v 1.61 2003/01/15 22:00:43 bouyer Exp $ */
/*
* Copyright (c) 1993 Dean Huxley <dean@fsa.ca>
@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1.60 2002/10/02 03:10:47 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1.61 2003/01/15 22:00:43 bouyer Exp $");
#include "opt_inet.h"
#include "opt_ns.h"
@ -659,6 +659,8 @@ loop:
memcpy(buffer, mtod(m, caddr_t), m->m_len);
buffer += m->m_len;
}
if (len > m0->m_pkthdr.len)
memset(buffer, 0, len - m0->m_pkthdr.len);
/* set direction bit: host -> adapter */
bus_space_write_1(iot, ioh, EG_CONTROL,

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_el.c,v 1.69 2002/10/02 03:10:47 thorpej Exp $ */
/* $NetBSD: if_el.c,v 1.70 2003/01/15 22:01:16 bouyer Exp $ */
/*
* Copyright (c) 1994, Matthew E. Kimmel. Permission is hereby granted
@ -19,7 +19,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_el.c,v 1.69 2002/10/02 03:10:47 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_el.c,v 1.70 2003/01/15 22:01:16 bouyer Exp $");
#include "opt_inet.h"
#include "opt_ns.h"
@ -432,6 +432,9 @@ elstart(ifp)
for (m = m0; m != 0; m = m->m_next)
bus_space_write_multi_1(iot, ioh, EL_BUF,
mtod(m, u_int8_t *), m->m_len);
for (i = 0;
i < ETHER_MIN_LEN - ETHER_CRC_LEN - m0->m_pkthdr.len; i++)
bus_space_write_1(iot, ioh, EL_BUF, 0);
m_freem(m0);