Date: Wed, 10 May 2017 10:23:30 -0600 From: Warner Losh <imp@bsdimp.com> To: Alan Somers <asomers@freebsd.org> Cc: src-committers <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org> Subject: Re: svn commit: r318144 - in head: usr.bin/mkuzip usr.sbin/pw Message-ID: <CANCZdfp-oTLteONGCG30sk-HsQBD9XOwEjZ4bLMGRwmxfQrgPw@mail.gmail.com> In-Reply-To: <201705101606.v4AG6M4i021690@repo.freebsd.org> References: <201705101606.v4AG6M4i021690@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, May 10, 2017 at 10:06 AM, Alan Somers <asomers@freebsd.org> wrote: > Author: asomers > Date: Wed May 10 16:06:22 2017 > New Revision: 318144 > URL: https://svnweb.freebsd.org/changeset/base/318144 > > Log: > Don't depend on assert(3) getting evaluated Thanks! You can ignore my other grump. I unwisely didn't read all my inbox. Warner > Reported by: imp > MFC after: 3 weeks > X-MFC-With: 318141, 318143 > Sponsored by: Spectra Logic Corp > > Modified: > head/usr.bin/mkuzip/mkuzip.c > head/usr.sbin/pw/pw_user.c > > Modified: head/usr.bin/mkuzip/mkuzip.c > ============================================================================== > --- head/usr.bin/mkuzip/mkuzip.c Wed May 10 15:38:06 2017 (r318143) > +++ head/usr.bin/mkuzip/mkuzip.c Wed May 10 16:06:22 2017 (r318144) > @@ -108,7 +108,7 @@ int main(int argc, char **argv) > struct mkuz_conveyor *cvp; > void *c_ctx; > struct mkuz_blk_info *chit; > - size_t ncpusz, ncpu; > + size_t ncpusz, ncpu, magiclen; > double st, et; > > st = getdtime(); > @@ -192,8 +192,8 @@ int main(int argc, char **argv) > /* Not reached */ > } > > - assert(strlcpy(hdr.magic, cfs.handler->magic, sizeof(hdr.magic)) > - < sizeof(hdr.magic)); > + magiclen = strlcpy(hdr.magic, cfs.handler->magic, sizeof(hdr.magic)); > + assert(magiclen < sizeof(hdr.magic)); > > if (cfs.en_dedup != 0) { > hdr.magic[CLOOP_OFS_VERSN] = CLOOP_MAJVER_3; > > Modified: head/usr.sbin/pw/pw_user.c > ============================================================================== > --- head/usr.sbin/pw/pw_user.c Wed May 10 15:38:06 2017 (r318143) > +++ head/usr.sbin/pw/pw_user.c Wed May 10 16:06:22 2017 (r318144) > @@ -491,6 +491,7 @@ pw_pwcrypt(char *password) > char salt[SALTSIZE + 1]; > char *cryptpw; > static char buf[256]; > + size_t pwlen; > > /* > * Calculate a salt value > @@ -502,7 +503,8 @@ pw_pwcrypt(char *password) > cryptpw = crypt(password, salt); > if (cryptpw == NULL) > errx(EX_CONFIG, "crypt(3) failure"); > - assert(strlcpy(buf, cryptpw, sizeof(buf)) < sizeof(buf)); > + pwlen = strlcpy(buf, cryptpw, sizeof(buf)); > + assert(pwlen < sizeof(buf)); > return (buf); > } > >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfp-oTLteONGCG30sk-HsQBD9XOwEjZ4bLMGRwmxfQrgPw>