Print URI up to 127 characters in x509_crt.c

This commit is contained in:
Andres Amaya Garcia
2017-08-21 11:07:36 +01:00
committed by Andres Amaya Garcia
parent a05c5edebc
commit 2c8546f8ad

View File

@@ -1500,9 +1500,14 @@ static int x509_info_authority_info_access( char **buf, size_t *size,
{
return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS + ret );
}
else
ret = mbedtls_snprintf( p, n, "%s[%s;%s]", sep, access_method,
"...too long..." );
/* Print informative string with up to 127 characters of the URI */
len = len > sizeof( access_location ) - 1 ?
sizeof( access_location ) - 1 : len;
memcpy( access_location, pos, len );
access_location[len] = '\0';
ret = mbedtls_snprintf( p, n, "%s[%s;%s]", sep, access_method,
access_location );
MBEDTLS_X509_SAFE_SNPRINTF;
sep = ", ";