From 1381e63d6caac1d5d064b60f6e2cb11bf0608e14 Mon Sep 17 00:00:00 2001 From: kevlo Date: Wed, 22 Feb 2012 06:27:20 +0000 Subject: Handle NULL return from crypt(3). Mostly from DragonFly --- sbin/init/init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sbin/init') diff --git a/sbin/init/init.c b/sbin/init/init.c index e936a78..3167503 100644 --- a/sbin/init/init.c +++ b/sbin/init/init.c @@ -657,7 +657,8 @@ single_user(void) _exit(0); password = crypt(clear, pp->pw_passwd); bzero(clear, _PASSWORD_LEN); - if (strcmp(password, pp->pw_passwd) == 0) + if (password == NULL || + strcmp(password, pp->pw_passwd) == 0) break; warning("single-user login failed\n"); } -- cgit v1.1