Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/net RFC 3542 (section 10.1) states that optlen shou...



details:   https://anonhg.NetBSD.org/src/rev/eaa834dea32b
branches:  trunk
changeset: 793351:eaa834dea32b
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Feb 07 02:36:06 2014 +0000

description:
RFC 3542 (section 10.1) states that optlen should only be checked when
opt != NULL (Eitan Adler)

diffstat:

 lib/libc/net/ip6opt.c |  9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diffs (31 lines):

diff -r 7e1d0dd2efbb -r eaa834dea32b lib/libc/net/ip6opt.c
--- a/lib/libc/net/ip6opt.c     Fri Feb 07 00:25:45 2014 +0000
+++ b/lib/libc/net/ip6opt.c     Fri Feb 07 02:36:06 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip6opt.c,v 1.14 2012/03/20 17:44:18 matt Exp $ */
+/*     $NetBSD: ip6opt.c,v 1.15 2014/02/07 02:36:06 christos Exp $     */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: ip6opt.c,v 1.14 2012/03/20 17:44:18 matt Exp $");
+__RCSID("$NetBSD: ip6opt.c,v 1.15 2014/02/07 02:36:06 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -442,11 +442,8 @@
 {
        struct ip6_ext *ext = (struct ip6_ext *)extbuf;
 
-       if (extlen % 8)
-               return (-1);
-
        if (ext) {
-               if (extlen == 0)
+               if (extlen == 0 || (extlen % 8))
                        return (-1);
                ext->ip6e_len = (extlen >> 3) - 1;
        }



Home | Main Index | Thread Index | Old Index