From owner-svn-src-head@FreeBSD.ORG Tue Feb 4 03:01:34 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 417DDDEE; Tue, 4 Feb 2014 03:01:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 266961727; Tue, 4 Feb 2014 03:01:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s1431Xsv027157; Tue, 4 Feb 2014 03:01:33 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s1431XgK027156; Tue, 4 Feb 2014 03:01:33 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201402040301.s1431XgK027156@svn.freebsd.org> From: Eitan Adler Date: Tue, 4 Feb 2014 03:01:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r261454 - head/lib/libc/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Feb 2014 03:01:34 -0000 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 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; }