Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Feb 2014 03:01:33 +0000 (UTC)
From:      Eitan Adler <eadler@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r261454 - head/lib/libc/net
Message-ID:  <201402040301.s1431XgK027156@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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:	swildner@dragonflybsd.org
  Reviewed by:	Mark Martinec <Mark.Martinec+freebsd@ijs.si>
  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;
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201402040301.s1431XgK027156>