From 2d6a2a5bed917bf3edc9a4ad6badb7e61230b818 Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Wed, 14 Jan 2015 19:00:43 -0500 Subject: [PATCH] Fix Coverity issues #102018 and #102015. --- src/modules/passwd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modules/passwd.c b/src/modules/passwd.c index 86fb2c5..90a6610 100644 --- a/src/modules/passwd.c +++ b/src/modules/passwd.c @@ -302,7 +302,7 @@ int ui_module_exec(char ***s, const struct passwd *pw, const int multi_char, add_string(&strings, tmp); break; case 'e': - if (!amroot) { + if (!amroot || !spwd) { add_string(&strings, "!"); break; } @@ -342,7 +342,9 @@ int ui_module_exec(char ***s, const struct passwd *pw, const int multi_char, if (!amroot) add_string(&strings, (pw->pw_passwd && pw->pw_passwd[0]) ? pw->pw_passwd : "-"); - else + else if (!spwd) + add_string(&strings, "-"); + else add_string(&strings, (spwd->sp_pwdp && spwd->sp_pwdp[0]) ? spwd->sp_pwdp : "-"); #else -- 2.11.4.GIT