From 32f7be2ab72ee22e98a2254709cb6128492b207a Mon Sep 17 00:00:00 2001 From: "Dr. David von Oheimb" Date: Tue, 17 Aug 2021 19:57:08 +0200 Subject: [PATCH] APPS: Fix result type of dump_cert_text() and behavior of print_name() on out==NULL Reviewed-by: Tomas Mraz Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/16344) --- apps/include/apps.h | 2 +- apps/lib/apps.c | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/apps/include/apps.h b/apps/include/apps.h index bc8c6359f3..9d5db16600 100644 --- a/apps/include/apps.h +++ b/apps/include/apps.h @@ -94,7 +94,7 @@ typedef struct args_st { int wrap_password_callback(char *buf, int bufsiz, int verify, void *cb_data); int chopup_args(ARGS *arg, char *buf); -int dump_cert_text(BIO *out, X509 *x); +void dump_cert_text(BIO *out, X509 *x); void print_name(BIO *out, const char *title, const X509_NAME *nm); void print_bignum_var(BIO *, const BIGNUM *, const char*, int, unsigned char *); diff --git a/apps/lib/apps.c b/apps/lib/apps.c index 9762001b6a..43c01401e8 100644 --- a/apps/lib/apps.c +++ b/apps/lib/apps.c @@ -200,14 +200,10 @@ unsigned long get_nameopt(void) return (nmflag_set) ? nmflag : XN_FLAG_ONELINE; } -int dump_cert_text(BIO *out, X509 *x) +void dump_cert_text(BIO *out, X509 *x) { print_name(out, "subject=", X509_get_subject_name(x)); - BIO_puts(out, "\n"); print_name(out, "issuer=", X509_get_issuer_name(x)); - BIO_puts(out, "\n"); - - return 0; } int wrap_password_callback(char *buf, int bufsiz, int verify, void *userdata) @@ -1289,6 +1285,8 @@ void print_name(BIO *out, const char *title, const X509_NAME *nm) int indent = 0; unsigned long lflags = get_nameopt(); + if (out == NULL) + return; if (title != NULL) BIO_puts(out, title); if ((lflags & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) {