static volatile sig_atomic_t alarm_rised;
static volatile sig_atomic_t sigchild;
+#define SULOGIN_PASSWORD_BUFSIZ 128
+
#ifndef IUCLC
# define IUCLC 0
#endif
* Ask for the password. Note that there is no default timeout as we normally
* skip this during boot.
*/
-static const char *getpasswd(struct console *con)
+static char *getpasswd(struct console *con)
{
struct sigaction sa;
struct termios tty;
- static char pass[128], *ptr;
+ static char pass[SULOGIN_PASSWORD_BUFSIZ], *ptr;
struct chardata *cp;
- const char *ret = NULL;
+ char *ret = NULL;
unsigned char tc;
char c, ascval;
int eightbit;
tcfinal(con);
printf("\r\n");
out:
+ if (ret == NULL)
+ explicit_bzero(pass, sizeof(pass));
return ret;
}
setup(con);
while (1) {
const char *passwd = pwd->pw_passwd;
- const char *answer;
+ char *answer;
int doshell = 0;
int deny = !opt_e && locked_account_password(pwd->pw_passwd);
if ((answer = getpasswd(con)) == NULL)
break;
- if (deny)
+ if (deny) {
+ explicit_bzero(answer, SULOGIN_PASSWORD_BUFSIZ);
exit(EXIT_FAILURE);
+ }
/* no password or locked account */
if (!passwd[0] || locked_account_password(passwd))
doshell++;
}
+ explicit_bzero(answer, SULOGIN_PASSWORD_BUFSIZ);
+
if (doshell) {
/* sushell() unmask signals */
sushell(pwd);