Source-Changes-HG archive

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

[src/netbsd-1-5]: src/sys/netinet6 Pull up revisions 1.9-1.10 (via patch, req...



details:   https://anonhg.NetBSD.org/src/rev/014aa841ffa9
branches:  netbsd-1-5
changeset: 490772:014aa841ffa9
user:      he <he%NetBSD.org@localhost>
date:      Mon Feb 26 22:59:09 2001 +0000

description:
Pull up revisions 1.9-1.10 (via patch, requested by itojun):
  Tighten IPv6 ND6/dest6 option chasing bounds check.

diffstat:

 sys/netinet6/dest6.c |  16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)

diffs (38 lines):

diff -r 7d4cc6b3f778 -r 014aa841ffa9 sys/netinet6/dest6.c
--- a/sys/netinet6/dest6.c      Mon Feb 26 22:52:12 2001 +0000
+++ b/sys/netinet6/dest6.c      Mon Feb 26 22:59:09 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dest6.c,v 1.7 2000/02/06 12:49:42 itojun Exp $ */
+/*     $NetBSD: dest6.c,v 1.7.4.1 2001/02/26 22:59:09 he Exp $ */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -88,22 +88,20 @@
 
        /* search header for all options. */
        for (optlen = 0; dstoptlen > 0; dstoptlen -= optlen, opt += optlen) {
+               if (*opt != IP6OPT_PAD1 &&
+                   (dstoptlen < IP6OPT_MINLEN || *(opt + 1) + 2 > dstoptlen)) {
+                       ip6stat.ip6s_toosmall++;
+                       goto bad;
+               }
+
                switch(*opt) {
                 case IP6OPT_PAD1:
                         optlen = 1;
                         break;
                 case IP6OPT_PADN:
-                        if (dstoptlen < IP6OPT_MINLEN) {
-                                ip6stat.ip6s_toosmall++;
-                                goto bad;
-                        }
                         optlen = *(opt + 1) + 2;
                         break;
                 default:               /* unknown option */
-                        if (dstoptlen < IP6OPT_MINLEN) {
-                                ip6stat.ip6s_toosmall++;
-                                goto bad;
-                        }
                         if ((optlen = ip6_unknown_opt(opt, m,
                                                       opt-mtod(m, u_int8_t *))) == -1)
                                 return(IPPROTO_DONE);



Home | Main Index | Thread Index | Old Index