forked from wolfSSL/wolfssl
wolfSSL_X509_NAME_print_ex should not put the null terminator in the BIO
This commit is contained in:
@ -538,6 +538,10 @@ then
|
||||
ENABLED_OPENSSLALL="yes"
|
||||
fi
|
||||
|
||||
if test "$ENABLED_NGINX" = "yes"
|
||||
then
|
||||
ENABLED_OPENSSLALL="yes"
|
||||
fi
|
||||
if test "$ENABLED_OPENSSLALL" = "yes"
|
||||
then
|
||||
AM_CFLAGS="-DOPENSSL_ALL -DWOLFSSL_EITHER_SIDE $AM_CFLAGS"
|
||||
@ -553,10 +557,6 @@ if test "$ENABLED_OPENSSH" = "yes" || test "$ENABLED_NGINX" = "yes" || test "$EN
|
||||
then
|
||||
ENABLED_OPENSSLEXTRA="yes"
|
||||
fi
|
||||
if test "$ENABLED_NGINX" = "yes"
|
||||
then
|
||||
ENABLED_OPENSSLALL="yes"
|
||||
fi
|
||||
if test "$ENABLED_OPENSSLEXTRA" = "yes" && test "x$ENABLED_OPENSSLCOEXIST" = "xno"
|
||||
then
|
||||
AM_CFLAGS="-DOPENSSL_EXTRA -DWOLFSSL_ALWAYS_VERIFY_CB $AM_CFLAGS"
|
||||
|
11
src/ssl.c
11
src/ssl.c
@ -39497,6 +39497,9 @@ static int get_dn_attr_by_nid(int n, const char** buf)
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The BIO output of wolfSSL_X509_NAME_print_ex does NOT include the null terminator
|
||||
*/
|
||||
int wolfSSL_X509_NAME_print_ex(WOLFSSL_BIO* bio, WOLFSSL_X509_NAME* name,
|
||||
int indent, unsigned long flags)
|
||||
{
|
||||
@ -39519,7 +39522,7 @@ int wolfSSL_X509_NAME_print_ex(WOLFSSL_BIO* bio, WOLFSSL_X509_NAME* name,
|
||||
|
||||
/* If XN_FLAG_DN_REV is present, print X509_NAME in reverse order */
|
||||
if (flags == (XN_FLAG_RFC2253 & ~XN_FLAG_DN_REV)) {
|
||||
#if defined(WOLFSSL_APACHE_HTTPD) || defined(OPENSSL_ALL)
|
||||
#if defined(WOLFSSL_APACHE_HTTPD) || defined(OPENSSL_ALL) || defined(WOLFSSL_NGINX)
|
||||
fullName[0] = '\0';
|
||||
count = wolfSSL_X509_NAME_entry_count(name);
|
||||
for (i = 0; i < count; i++) {
|
||||
@ -39551,17 +39554,19 @@ int wolfSSL_X509_NAME_print_ex(WOLFSSL_BIO* bio, WOLFSSL_X509_NAME* name,
|
||||
}
|
||||
totalSz += tmpSz;
|
||||
}
|
||||
if (fullName[totalSz-1] == '\0')
|
||||
totalSz--;
|
||||
if (wolfSSL_BIO_write(bio, fullName, totalSz) != totalSz)
|
||||
return WOLFSSL_FAILURE;
|
||||
return WOLFSSL_SUCCESS;
|
||||
#endif /* WOLFSSL_APACHE_HTTPD || OPENSSL_ALL */
|
||||
#endif /* WOLFSSL_APACHE_HTTPD || OPENSSL_ALL || WOLFSSL_NGINX */
|
||||
}
|
||||
else if (flags == XN_FLAG_RFC2253) {
|
||||
if (wolfSSL_BIO_write(bio, name->name + 1, name->sz - 2)
|
||||
!= name->sz - 2)
|
||||
return WOLFSSL_FAILURE;
|
||||
}
|
||||
else if (wolfSSL_BIO_write(bio, name->name, name->sz) != name->sz)
|
||||
else if (wolfSSL_BIO_write(bio, name->name, name->sz - 1) != name->sz - 1)
|
||||
return WOLFSSL_FAILURE;
|
||||
|
||||
return WOLFSSL_SUCCESS;
|
||||
|
Reference in New Issue
Block a user