[Midnightbsd-cvs] src [11580] trunk/usr.bin/chkey/chkey.c: check fo rnull

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Jul 8 11:38:34 EDT 2018


Revision: 11580
          http://svnweb.midnightbsd.org/src/?rev=11580
Author:   laffer1
Date:     2018-07-08 11:38:33 -0400 (Sun, 08 Jul 2018)
Log Message:
-----------
check fo rnull

Modified Paths:
--------------
    trunk/usr.bin/chkey/chkey.c

Modified: trunk/usr.bin/chkey/chkey.c
===================================================================
--- trunk/usr.bin/chkey/chkey.c	2018-07-08 15:38:12 UTC (rev 11579)
+++ trunk/usr.bin/chkey/chkey.c	2018-07-08 15:38:33 UTC (rev 11580)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  * unrestricted use provided that this legend is included on all tape
@@ -35,7 +36,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/chkey/chkey.c 231994 2012-02-22 06:27:20Z kevlo $");
 
 /*
  * Copyright (C) 1986, Sun Microsystems, Inc.
@@ -94,6 +95,9 @@
 #ifdef YP
 	char *master;
 #endif
+#ifdef YPPASSWD
+	char *cryptpw;
+#endif
 
 	while ((ch = getopt(argc, argv, "f")) != -1)
 		switch(ch) {
@@ -149,7 +153,8 @@
 	pass = getpass("Password:");
 #ifdef YPPASSWD
 	if (!force) {
-		if (strcmp(crypt(pass, pw->pw_passwd), pw->pw_passwd) != 0)
+		cryptpw = crypt(pass, pw->pw_passwd);
+		if (cryptpw == NULL || strcmp(cryptpw, pw->pw_passwd) != 0)
 			errx(1, "invalid password");
 	}
 #else



More information about the Midnightbsd-cvs mailing list