cmp: handle error return from OBJ_obj2txt()

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12678)
This commit is contained in:
Pauli 2020-08-19 13:57:00 +10:00
parent ffcdb24b13
commit 3b1fd0b003

View File

@ -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);
}
}