Truncate the incoming packet if it doesn't fit into the buffer.

This commit is contained in:
thorpej 1995-10-19 18:43:27 +00:00
parent 6ac54c7a78
commit 62150b43b1
1 changed files with 12 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_le.c,v 1.6 1995/09/02 05:04:18 thorpej Exp $ */
/* $NetBSD: if_le.c,v 1.7 1995/10/19 18:43:27 thorpej Exp $ */
/*
* Copyright (c) 1993 Adam Glass
@ -501,8 +501,18 @@ le_poll(desc, pkt, len)
if (!length)
goto cleanup;
length -= 4;
if (length > 0)
if (length > 0) {
/*
* If the length of the packet is greater than the size of the
* buffer, we have to truncate it, to avoid Bad Things.
* XXX Is this the right thing to do?
*/
if (length > len)
length = len;
bcopy(sc->sc_rbuf + (BUFSIZE * sc->sc_next_rd), pkt, length);
}
cleanup:
cdm->mcnt = 0;