Source-Changes-HG archive

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

[src/netbsd-1-5]: src/sbin/ping6 Pullup 1.22 (with -Wunused fix) [itojun]:



details:   https://anonhg.NetBSD.org/src/rev/13142f2d9c1f
branches:  netbsd-1-5
changeset: 489752:13142f2d9c1f
user:      tv <tv%NetBSD.org@localhost>
date:      Mon Oct 16 23:31:30 2000 +0000

description:
Pullup 1.22 (with -Wunused fix) [itojun]:
do not segv on too many args. sync with kame

diffstat:

 sbin/ping6/ping6.c |  19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diffs (48 lines):

diff -r 88a82782e809 -r 13142f2d9c1f sbin/ping6/ping6.c
--- a/sbin/ping6/ping6.c        Mon Oct 16 23:25:40 2000 +0000
+++ b/sbin/ping6/ping6.c        Mon Oct 16 23:31:30 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ping6.c,v 1.15.2.1 2000/07/27 16:12:35 itojun Exp $    */
+/*     $NetBSD: ping6.c,v 1.15.2.2 2000/10/16 23:31:30 tv Exp $        */
 /*     $KAME: ping6.c,v 1.55 2000/06/12 16:18:32 itojun Exp $  */
 
 /*
@@ -81,7 +81,7 @@
 #else
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: ping6.c,v 1.15.2.1 2000/07/27 16:12:35 itojun Exp $");
+__RCSID("$NetBSD: ping6.c,v 1.15.2.2 2000/10/16 23:31:30 tv Exp $");
 #endif
 #endif
 
@@ -285,6 +285,7 @@
        char *policy_in = NULL;
        char *policy_out = NULL;
 #endif
+       size_t rthlen;
 
        /* just to be sure */
        memset(&smsghdr, 0, sizeof(&smsghdr));
@@ -476,11 +477,17 @@
        }
 
        if (argc > 1) {
-#ifdef USE_SIN6_SCOPE_ID
-               ip6optlen += CMSG_SPACE(inet6_rth_space(IPV6_RTHDR_TYPE_0, argc - 1));
-#else  /* old advanced API */
-               ip6optlen += inet6_rthdr_space(IPV6_RTHDR_TYPE_0, argc - 1);
+#ifdef IPV6_RECVRTHDR  /* 2292bis */
+               rthlen = CMSG_SPACE(inet6_rth_space(IPV6_RTHDR_TYPE_0,
+                   argc - 1));
+#else  /* RFC2292 */
+               rthlen = inet6_rthdr_space(IPV6_RTHDR_TYPE_0, argc - 1);
 #endif
+               if (rthlen == 0) {
+                       errx(1, "too many intermediate hops");
+                       /*NOTREACHED*/
+               }
+               ip6optlen += rthlen;
        }
 
        if (options & F_NIGROUP) {



Home | Main Index | Thread Index | Old Index