svn commit: r318144 - in head: usr.bin/mkuzip usr.sbin/pw

Alan Somers asomers at FreeBSD.org
Wed May 10 16:06:24 UTC 2017


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
  
  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);
 }
 


More information about the svn-src-all mailing list