2727 #endif
2828#else
2929
30+ #pragma GCC diagnostic ignored "-Wformat-truncation"
31+
3032#ifndef WOLFCRYPT_ONLY
3133
3234#ifndef NO_CERTS
@@ -1474,12 +1476,6 @@ static WOLFSSL_ASN1_STRING* wolfSSL_X509_EXTENSION_get_data_internal(
14741476
14751477
14761478#ifndef NO_BIO
1477-
1478- #ifndef MAX_INDENT
1479- #define MAX_INDENT 40
1480- #endif
1481-
1482-
14831479/* Return 0 on success and 1 on failure. Copies ext data to bio, using indent
14841480 * to pad the output. flag is ignored. */
14851481int wolfSSL_X509V3_EXT_print (WOLFSSL_BIO * out , WOLFSSL_X509_EXTENSION * ext ,
@@ -1494,9 +1490,6 @@ int wolfSSL_X509V3_EXT_print(WOLFSSL_BIO *out, WOLFSSL_X509_EXTENSION *ext,
14941490 int tmpLen = 0 ;
14951491 WOLFSSL_ENTER ("wolfSSL_X509V3_EXT_print" );
14961492
1497- if (indent < 0 ) indent = 0 ;
1498- if (indent > MAX_INDENT ) indent = MAX_INDENT ;
1499-
15001493 if ((out == NULL ) || (ext == NULL )) {
15011494 WOLFSSL_MSG ("NULL parameter error" );
15021495 return rc ;
@@ -6329,9 +6322,6 @@ static int X509PrintKeyUsage(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, int indent)
63296322 "Decipher Only"
63306323 };
63316324
6332- if (indent < 0 ) indent = 0 ;
6333- if (indent > MAX_INDENT ) indent = MAX_INDENT ;
6334-
63356325 if (bio == NULL || x509 == NULL ) {
63366326 ret = WOLFSSL_FAILURE ;
63376327 }
@@ -6503,9 +6493,6 @@ static int X509PrintSerial(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, int indent)
65036493 unsigned char serial [32 ];
65046494 int sz = sizeof (serial );
65056495
6506- if (indent < 0 ) indent = 0 ;
6507- if (indent > MAX_INDENT ) indent = MAX_INDENT ;
6508-
65096496 XMEMSET (serial , 0 , sz );
65106497 if (wolfSSL_X509_get_serial_number (x509 , serial , & sz ) == WOLFSSL_SUCCESS ) {
65116498 X509PrintSerial_ex (bio , serial , sz , 1 , indent );
@@ -6598,9 +6585,6 @@ static int X509PrintExtensions(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, int indent)
65986585 int count , i ;
65996586 char * buf = NULL ;
66006587
6601- if (indent < 0 ) indent = 0 ;
6602- if (indent > MAX_INDENT ) indent = MAX_INDENT ;
6603-
66046588 count = wolfSSL_X509_get_ext_count (x509 );
66056589 if (count <= 0 )
66066590 return WOLFSSL_SUCCESS ;
@@ -7014,9 +6998,6 @@ static int X509PrintPubKey(WOLFSSL_BIO* bio, WOLFSSL_X509* x509, int indent)
70146998 int len ;
70156999 int ret = WOLFSSL_SUCCESS ;
70167000
7017- if (indent < 0 ) indent = 0 ;
7018- if (indent > MAX_INDENT ) indent = MAX_INDENT ;
7019-
70207001 if (bio == NULL || x509 == NULL )
70217002 return BAD_FUNC_ARG ;
70227003
@@ -7104,9 +7085,6 @@ static int X509PrintVersion(WOLFSSL_BIO* bio, int version, int indent)
71047085 char scratch [MAX_WIDTH ];
71057086 int scratchLen ;
71067087
7107- if (indent < 0 ) indent = 0 ;
7108- if (indent > MAX_INDENT ) indent = MAX_INDENT ;
7109-
71107088 scratchLen = XSNPRINTF (scratch , MAX_WIDTH , "%*s%s" , indent , "" , "Version:" );
71117089 if ((scratchLen < 0 ) || (scratchLen >= MAX_WIDTH )) {
71127090 return WOLFSSL_FAILURE ;
@@ -7140,9 +7118,6 @@ static int X509PrintReqAttributes(WOLFSSL_BIO* bio, WOLFSSL_X509* x509,
71407118 int scratchLen ;
71417119 int i = 0 ;
71427120
7143- if (indent < 0 ) indent = 0 ;
7144- if (indent > MAX_INDENT ) indent = MAX_INDENT ;
7145-
71467121 if ((scratchLen = XSNPRINTF (scratch , MAX_WIDTH ,
71477122 "%*s%s" , indent , "" , "Attributes: \n" ))
71487123 >= MAX_WIDTH )
@@ -8890,9 +8865,6 @@ static int X509RevokedPrintSerial(WOLFSSL_BIO* bio, RevokedCert* rev,
88908865 unsigned char serial [32 ];
88918866 int sz = sizeof (serial );
88928867
8893- if (indent < 0 ) indent = 0 ;
8894- if (indent > MAX_INDENT ) indent = MAX_INDENT ;
8895-
88968868 XMEMSET (serial , 0 , sz );
88978869 if (wolfSSL_X509_REVOKED_get_serial_number (rev , serial , & sz )
88988870 == WOLFSSL_SUCCESS ) {
@@ -8951,12 +8923,9 @@ static int X509CRLPrintSignature(WOLFSSL_BIO* bio, WOLFSSL_X509_CRL* crl,
89518923static int X509CRLPrintExtensions (WOLFSSL_BIO * bio , WOLFSSL_X509_CRL * crl ,
89528924 int indent )
89538925{
8954- char tmp [MAX_WIDTH ];
8926+ char tmp [MAX_WIDTH ]; /* buffer for XSNPRINTF */
89558927 int ret = 0 ;
89568928
8957- if (indent < 0 ) indent = 0 ;
8958- if (indent > MAX_INDENT ) indent = MAX_INDENT ;
8959-
89608929 if (XSNPRINTF (tmp , MAX_WIDTH , "%*s%s\n" , indent , "" ,
89618930 "CRL extensions:" ) >= MAX_WIDTH ) {
89628931 ret = WOLFSSL_FAILURE ;
0 commit comments