From 2c8546f8adfcf344c421ce5dfe3304e8125d45db Mon Sep 17 00:00:00 2001 From: Andres Amaya Garcia Date: Mon, 21 Aug 2017 11:07:36 +0100 Subject: [PATCH] Print URI up to 127 characters in x509_crt.c --- library/x509_crt.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/library/x509_crt.c b/library/x509_crt.c index 0f7fd13a05..82a880df82 100644 --- a/library/x509_crt.c +++ b/library/x509_crt.c @@ -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 = ", ";