Protect against routing socket messages with way-too-big address families.

Submitted by:	Keith Sklower by way of Paul Traina
This commit is contained in:
Garrett Wollman 1995-10-13 16:01:59 +00:00
parent 91badc866f
commit ed07cc7f09
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=11459

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)rtsock.c 8.5 (Berkeley) 11/2/94
* $Id: rtsock.c,v 1.13 1995/05/30 08:08:31 rgrimes Exp $
* $Id: rtsock.c,v 1.14 1995/10/09 04:06:28 bde Exp $
*/
#include <sys/param.h>
@ -169,7 +169,8 @@ route_output(m, so)
rtm->rtm_pid = curproc->p_pid;
info.rti_addrs = rtm->rtm_addrs;
rt_xaddrs((caddr_t)(rtm + 1), len + (caddr_t)rtm, &info);
if (dst == 0)
if (dst == 0 || (dst->sa_family >= AF_MAX)
|| (gate != 0 && (gate->sa_family >= AF_MAX)))
senderr(EINVAL);
if (genmask) {
struct radix_node *t;