aboutsummaryrefslogtreecommitdiff
path: root/loginutils
diff options
context:
space:
mode:
Diffstat (limited to 'loginutils')
-rw-r--r--loginutils/cryptpw.c2
-rw-r--r--loginutils/passwd.c3
2 files changed, 2 insertions, 3 deletions
diff --git a/loginutils/cryptpw.c b/loginutils/cryptpw.c
index 3ca7eda4a..fbb7f0515 100644
--- a/loginutils/cryptpw.c
+++ b/loginutils/cryptpw.c
@@ -133,7 +133,7 @@ int cryptpw_main(int argc UNUSED_PARAM, char **argv)
if (!password) {
/* Only mkpasswd, and only from tty, prompts.
* Otherwise it is a plain read. */
- password = (ENABLE_MKPASSWD && isatty(STDIN_FILENO) && applet_name[0] == 'm')
+ password = (ENABLE_MKPASSWD && applet_name[0] == 'm' && isatty(STDIN_FILENO))
? bb_ask_noecho_stdin("Password: ")
: xmalloc_fgetline(stdin)
;
diff --git a/loginutils/passwd.c b/loginutils/passwd.c
index 02303b575..d0408d8b4 100644
--- a/loginutils/passwd.c
+++ b/loginutils/passwd.c
@@ -65,11 +65,9 @@ static char* new_password(const struct passwd *pw, uid_t myuid, const char *algo
if (ENABLE_FEATURE_CLEAN_UP)
free(encrypted);
}
- orig = xstrdup(orig); /* or else bb_ask_noecho_stdin() will destroy it */
newp = bb_ask_noecho_stdin("New password: "); /* returns ptr to static */
if (!newp)
goto err_ret;
- newp = xstrdup(newp); /* we are going to bb_ask_noecho_stdin() again, so save it */
if (ENABLE_FEATURE_PASSWD_WEAK_CHECK
&& obscure(orig, newp, pw)
&& myuid != 0
@@ -99,6 +97,7 @@ static char* new_password(const struct passwd *pw, uid_t myuid, const char *algo
if (ENABLE_FEATURE_CLEAN_UP) free(newp);
nuke_str(cp);
+ if (ENABLE_FEATURE_CLEAN_UP) free(cp);
return ret;
}