In udp_output(), sanity check the length of the packet to be transmitted.
If it's larger than IP_MAXPACKET, return an error condition. Based on a patch from Bill Fenner <fenner@parc.xerox.com>
This commit is contained in:
parent
59bbc2199e
commit
096b0d6c6e
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: udp_usrreq.c,v 1.38 1996/10/16 19:33:39 ws Exp $ */
|
||||
/* $NetBSD: udp_usrreq.c,v 1.39 1996/10/25 06:35:16 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1988, 1990, 1993
|
||||
|
@ -449,6 +449,15 @@ udp_output(m, va_alist)
|
|||
goto release;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute the packet length of the IP header, and
|
||||
* punt if the length looks bogus.
|
||||
*/
|
||||
if ((len + sizeof(struct udpiphdr)) > IP_MAXPACKET) {
|
||||
error = EMSGSIZE;
|
||||
goto release;
|
||||
}
|
||||
|
||||
/*
|
||||
* Fill in mbuf with extended UDP header
|
||||
* and addresses and length put into network format.
|
||||
|
|
Loading…
Reference in New Issue