From ad65d3d8936e4ddd5c246fac2041d82c3a33301a Mon Sep 17 00:00:00 2001 From: itojun Date: Sun, 4 Feb 2001 00:35:20 +0000 Subject: [PATCH] correct recvmsg() validation. --- sbin/ping6/ping6.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sbin/ping6/ping6.c b/sbin/ping6/ping6.c index 8241841ad11a..e935d814ed82 100644 --- a/sbin/ping6/ping6.c +++ b/sbin/ping6/ping6.c @@ -1,5 +1,5 @@ -/* $NetBSD: ping6.c,v 1.31 2001/01/26 13:18:45 itojun Exp $ */ -/* $KAME: ping6.c,v 1.118 2001/01/26 13:14:29 itojun Exp $ */ +/* $NetBSD: ping6.c,v 1.32 2001/02/04 00:35:20 itojun Exp $ */ +/* $KAME: ping6.c,v 1.121 2001/02/01 16:43:01 itojun Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -81,7 +81,7 @@ static char sccsid[] = "@(#)ping.c 8.1 (Berkeley) 6/5/93"; #else #include #ifndef lint -__RCSID("$NetBSD: ping6.c,v 1.31 2001/01/26 13:18:45 itojun Exp $"); +__RCSID("$NetBSD: ping6.c,v 1.32 2001/02/04 00:35:20 itojun Exp $"); #endif #endif @@ -1349,7 +1349,8 @@ pr_pack(buf, cc, mhdr) (void)gettimeofday(&tv, NULL); - if (!mhdr || !mhdr->msg_name || mhdr->msg_namelen != sizeof(*from) || + if (!mhdr || !mhdr->msg_name || + mhdr->msg_namelen != sizeof(struct sockaddr_in6) || ((struct sockaddr *)mhdr->msg_name)->sa_family != AF_INET6) { if (options & F_VERBOSE) warnx("invalid peername\n");