Author: eadler
Date: Tue Feb  4 03:01:33 2014
New Revision: 261454
URL: http://svnweb.freebsd.org/changeset/base/261454

Log:
  libc/net: Fix some issues in inet6_opt_init() (from RFC 3542):
  
  * The RFC says (in section 10.1) that only when extbuf is not NULL,
  extlen shall be checked, so don't perform this check when NULL is
  passed.
  
  * socklen_t is unsigned, so checking extlen for less than zero is
  not needed.
  
  Submitted by: [email protected]
  Reviewed by:  Mark Martinec <[email protected]>
  Reviewed by:  hrs
  Obtained by:  DragonFlyBSD

Modified:
  head/lib/libc/net/ip6opt.c

Modified: head/lib/libc/net/ip6opt.c
==============================================================================
--- head/lib/libc/net/ip6opt.c  Tue Feb  4 02:45:08 2014        (r261453)
+++ head/lib/libc/net/ip6opt.c  Tue Feb  4 03:01:33 2014        (r261454)
@@ -381,11 +381,8 @@ inet6_opt_init(void *extbuf, socklen_t e
 {
        struct ip6_ext *ext = (struct ip6_ext *)extbuf;
 
-       if (extlen < 0 || (extlen % 8))
-               return(-1);
-
        if (ext) {
-               if (extlen == 0)
+               if (extlen == 0 || (extlen % 8))
                        return(-1);
                ext->ip6e_len = (extlen >> 3) - 1;
        }
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to