summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--login-utils/logindefs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/login-utils/logindefs.c b/login-utils/logindefs.c
index f02c4752d..213ff8d25 100644
--- a/login-utils/logindefs.c
+++ b/login-utils/logindefs.c
@@ -344,7 +344,8 @@ int get_hushlogin_status(struct passwd *pwd, int force_check)
continue; /* ignore errors... */
while (ok == 0 && fgets(buf, sizeof(buf), f)) {
- buf[strlen(buf) - 1] = '\0';
+ if (buf[0] != '\0')
+ buf[strlen(buf) - 1] = '\0';
ok = !strcmp(buf, *buf == '/' ? pwd->pw_shell :
pwd->pw_name);
}