mirror of
https://github.com/openssl/openssl.git
synced 2024-11-27 05:21:51 +08:00
pkeyutil: check return value reading password
Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/12678)
This commit is contained in:
parent
16486f6332
commit
ffcdb24b13
@ -331,9 +331,18 @@ int pkeyutl_main(int argc, char **argv)
|
||||
if (passin == NULL) {
|
||||
/* Get password interactively */
|
||||
char passwd_buf[4096];
|
||||
int r;
|
||||
|
||||
BIO_snprintf(passwd_buf, sizeof(passwd_buf), "Enter %s: ", opt);
|
||||
EVP_read_pw_string(passwd_buf, sizeof(passwd_buf) - 1,
|
||||
passwd_buf, 0);
|
||||
r = EVP_read_pw_string(passwd_buf, sizeof(passwd_buf) - 1,
|
||||
passwd_buf, 0);
|
||||
if (r < 0) {
|
||||
if (r == -2)
|
||||
BIO_puts(bio_err, "user abort\n");
|
||||
else
|
||||
BIO_puts(bio_err, "entry failed\n");
|
||||
goto end;
|
||||
}
|
||||
passwd = OPENSSL_strdup(passwd_buf);
|
||||
if (passwd == NULL) {
|
||||
BIO_puts(bio_err, "out of memory\n");
|
||||
|
Loading…
Reference in New Issue
Block a user