Date: Fri, 27 Feb 2015 01:59:30 +0000 (UTC) From: "Pedro F. Giffuni" <pfg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r279344 - head/lib/libc/net Message-ID: <201502270159.t1R1xUoh057520@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pfg Date: Fri Feb 27 01:59:29 2015 New Revision: 279344 URL: https://svnweb.freebsd.org/changeset/base/279344 Log: Hint out check for unsigned negative values. On FreeBSD socklen_t is unsigned so the check negative len in inet6_opt_append() is redundant and likely to be optimized away by the compiler. On other operating systems this is not necessarily so, and in the future we may want to sign it so leave the check in but place it in a secondary position as a subtle indication that the bogus check is intentional. Discussed with: rpaulo CID: 1017783 Modified: head/lib/libc/net/ip6opt.c Modified: head/lib/libc/net/ip6opt.c ============================================================================== --- head/lib/libc/net/ip6opt.c Fri Feb 27 01:20:17 2015 (r279343) +++ head/lib/libc/net/ip6opt.c Fri Feb 27 01:59:29 2015 (r279344) @@ -419,7 +419,7 @@ inet6_opt_append(void *extbuf, socklen_t * The option data length must have a value between 0 and 255, * inclusive, and is the length of the option data that follows. */ - if (len < 0 || len > 255) + if (len > 255 || len < 0 ) return(-1); /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502270159.t1R1xUoh057520>