@@ -22154,7 +22154,7 @@ static int test_wolfSSL_X509_NAME_print_ex(void)
2215422154 ExpectIntEQ(X509_NAME_print_ex(NULL, NULL, 0, 0), WOLFSSL_FAILURE);
2215522155 ExpectIntEQ(X509_NAME_print_ex(membio, NULL, 0, 0), WOLFSSL_FAILURE);
2215622156 ExpectIntEQ(X509_NAME_print_ex(NULL, name, 0, 0), WOLFSSL_FAILURE);
22157- ExpectIntEQ(X509_NAME_print_ex(membio, empty, 0, 0), WOLFSSL_FAILURE );
22157+ ExpectIntEQ(X509_NAME_print_ex(membio, empty, 0, 0), WOLFSSL_SUCCESS );
2215822158 ExpectIntEQ(X509_NAME_print_ex(membio, name, 0, 0), WOLFSSL_SUCCESS);
2215922159 wolfSSL_X509_NAME_free(empty);
2216022160 BIO_free(membio);
@@ -22178,6 +22178,23 @@ static int test_wolfSSL_X509_NAME_print_ex(void)
2217822178 BIO_free(bio);
2217922179 name = NULL;
2218022180
22181+ /* Test with empty issuer cert. */
22182+ ExpectNotNull(bio = BIO_new(BIO_s_file()));
22183+ ExpectIntGT(BIO_read_filename(bio, noIssuerCertFile), 0);
22184+ ExpectNotNull(PEM_read_bio_X509(bio, &x509, NULL, NULL));
22185+ ExpectNotNull(name = X509_get_subject_name(x509));
22186+
22187+ ExpectNotNull(membio = BIO_new(BIO_s_mem()));
22188+ ExpectIntEQ(X509_NAME_print_ex(membio, name, 0, 0), WOLFSSL_SUCCESS);
22189+ /* Should be empty string "" */
22190+ ExpectIntEQ((memSz = BIO_get_mem_data(membio, &mem)), 0);
22191+
22192+ BIO_free(membio);
22193+ membio = NULL;
22194+ X509_free(x509);
22195+ BIO_free(bio);
22196+ name = NULL;
22197+
2218122198 /* Test normal case without escaped characters */
2218222199 {
2218322200 /* Create name: "/C=US/CN=wolfssl.com" */
0 commit comments