Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/ping6 correct recvmsg() validation.



details:   https://anonhg.NetBSD.org/src/rev/d3f4d3dc63d1
branches:  trunk
changeset: 503252:d3f4d3dc63d1
user:      itojun <itojun%NetBSD.org@localhost>
date:      Sun Feb 04 00:35:20 2001 +0000

description:
correct recvmsg() validation.

diffstat:

 sbin/ping6/ping6.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (30 lines):

diff -r 13e1a14d7500 -r d3f4d3dc63d1 sbin/ping6/ping6.c
--- a/sbin/ping6/ping6.c        Sat Feb 03 23:25:51 2001 +0000
+++ b/sbin/ping6/ping6.c        Sun Feb 04 00:35:20 2001 +0000
@@ -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 @@
 #else
 #include <sys/cdefs.h>
 #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 @@
 
        (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");



Home | Main Index | Thread Index | Old Index