The branch master has been updated via 3b1fd0b003572554ad9bb3914527c160bc6a7727 (commit) via ffcdb24b13590190e92c7f88e2ad3e0a721408f2 (commit) from 16486f6332410d0d9e8f2606abb970d32b0572d3 (commit)
- Log ----------------------------------------------------------------- commit 3b1fd0b003572554ad9bb3914527c160bc6a7727 Author: Pauli <paul.d...@oracle.com> Date: Wed Aug 19 13:57:00 2020 +1000 cmp: handle error return from OBJ_obj2txt() Reviewed-by: Richard Levitte <levi...@openssl.org> (Merged from https://github.com/openssl/openssl/pull/12678) commit ffcdb24b13590190e92c7f88e2ad3e0a721408f2 Author: Pauli <paul.d...@oracle.com> Date: Wed Aug 19 13:40:22 2020 +1000 pkeyutil: check return value reading password Reviewed-by: Richard Levitte <levi...@openssl.org> (Merged from https://github.com/openssl/openssl/pull/12678) ----------------------------------------------------------------------- Summary of changes: apps/cmp.c | 11 ++++++++--- apps/pkeyutl.c | 13 +++++++++++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/apps/cmp.c b/apps/cmp.c index f0b3148714..b2afbf64e8 100644 --- a/apps/cmp.c +++ b/apps/cmp.c @@ -2241,7 +2241,7 @@ static void print_itavs(STACK_OF(OSSL_CMP_ITAV) *itavs) { OSSL_CMP_ITAV *itav = NULL; char buf[128]; - int i; + int i, r; int n = sk_OSSL_CMP_ITAV_num(itavs); /* itavs == NULL leads to 0 */ if (n == 0) { @@ -2251,8 +2251,13 @@ static void print_itavs(STACK_OF(OSSL_CMP_ITAV) *itavs) for (i = 0; i < n; i++) { itav = sk_OSSL_CMP_ITAV_value(itavs, i); - OBJ_obj2txt(buf, 128, OSSL_CMP_ITAV_get0_type(itav), 0); - CMP_info1("genp contains ITAV of type: %s", buf); + r = OBJ_obj2txt(buf, 128, OSSL_CMP_ITAV_get0_type(itav), 0); + if (r < 0) + CMP_err("could not get ITAV details"); + else if (r == 0) + CMP_info("genp contains empty ITAV"); + else + CMP_info1("genp contains ITAV of type: %s", buf); } } diff --git a/apps/pkeyutl.c b/apps/pkeyutl.c index 4de2a56590..9bfef87311 100644 --- a/apps/pkeyutl.c +++ b/apps/pkeyutl.c @@ -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");