svn commit: r261454 - head/lib/libc/net

Eitan Adler eadler at FreeBSD.org
Tue Feb 4 03:01:34 UTC 2014


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 at dragonflybsd.org
  Reviewed by:	Mark Martinec <Mark.Martinec+freebsd at 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;
 	}


More information about the svn-src-head mailing list