@@ -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,24 @@ static int test_wolfSSL_X509_NAME_print_ex(void)
2217822178 BIO_free(bio);
2217922179 name = NULL;
2218022180
22181+ /* Test with empty issuer cert empty-issuer-cert.pem.
22182+ * See notes in certs/test/gen-testcerts.sh for how it was generated. */
22183+ ExpectNotNull(bio = BIO_new(BIO_s_file()));
22184+ ExpectIntGT(BIO_read_filename(bio, noIssuerCertFile), 0);
22185+ ExpectNotNull(PEM_read_bio_X509(bio, &x509, NULL, NULL));
22186+ ExpectNotNull(name = X509_get_subject_name(x509));
22187+
22188+ ExpectNotNull(membio = BIO_new(BIO_s_mem()));
22189+ ExpectIntEQ(X509_NAME_print_ex(membio, name, 0, 0), WOLFSSL_SUCCESS);
22190+ /* Should be empty string "" */
22191+ ExpectIntEQ((memSz = BIO_get_mem_data(membio, &mem)), 0);
22192+
22193+ BIO_free(membio);
22194+ membio = NULL;
22195+ X509_free(x509);
22196+ BIO_free(bio);
22197+ name = NULL;
22198+
2218122199 /* Test normal case without escaped characters */
2218222200 {
2218322201 /* Create name: "/C=US/CN=wolfssl.com" */
0 commit comments