Don't count null char in better way

This commit is contained in:
Juliusz Sosinowicz
2019-11-07 11:41:46 +01:00
parent 7c1a1dfd1f
commit 944d5e1045
2 changed files with 9 additions and 3 deletions

View File

@@ -4351,6 +4351,7 @@ static void test_wolfSSL_X509_NAME_get_entry(void)
ASN1_STRING* asn;
int idx;
ASN1_OBJECT *object = NULL;
BIO* bio;
#ifndef NO_FILESYSTEM
x509 = wolfSSL_X509_load_certificate_file(cliCertFile, WOLFSSL_FILETYPE_PEM);
@@ -4373,6 +4374,11 @@ static void test_wolfSSL_X509_NAME_get_entry(void)
idx = X509_NAME_get_index_by_NID(name, NID_commonName, -1);
AssertIntGE(idx, 0);
AssertNotNull(bio = BIO_new(BIO_s_mem()));
AssertIntEQ(X509_NAME_print_ex(bio, name, 4,
(XN_FLAG_RFC2253 & ~XN_FLAG_DN_REV)), WOLFSSL_SUCCESS);
BIO_free(bio);
ne = X509_NAME_get_entry(name, idx);
AssertNotNull(ne);
AssertNotNull(object = X509_NAME_ENTRY_get_object(ne));