diff --git a/src/pk.c b/src/pk.c index 903b652a7..06de3d5e0 100644 --- a/src/pk.c +++ b/src/pk.c @@ -155,7 +155,8 @@ static int wolfssl_print_indent(WOLFSSL_BIO* bio, char* line, int lineLen, if (len_wanted >= lineLen) { WOLFSSL_MSG("Buffer overflow formatting indentation"); ret = 0; - } else { + } + else { /* Write indents string to BIO */ if (wolfSSL_BIO_write(bio, line, len_wanted) <= 0) { ret = 0; @@ -261,7 +262,8 @@ static int wolfssl_print_number(WOLFSSL_BIO* bio, mp_int* num, const char* name, if (li >= (int)sizeof(line)) { WOLFSSL_MSG("Buffer overflow formatting name"); ret = 0; - } else { + } + else { if (wolfSSL_BIO_write(bio, line, li) <= 0) { ret = 0; } @@ -306,8 +308,10 @@ static int wolfssl_print_number(WOLFSSL_BIO* bio, mp_int* num, const char* name, /* Put the leading spaces on new line. */ XSTRNCPY(line, PRINT_NUM_INDENT, PRINT_NUM_INDENT_CNT + 1); li = PRINT_NUM_INDENT_CNT; - } else + } + else { li += len_wanted; + } } if (ret == 1) { @@ -1922,7 +1926,8 @@ int wolfSSL_RSA_print(WOLFSSL_BIO* bio, WOLFSSL_RSA* rsa, int indent) if (len >= (int)sizeof(line)) { WOLFSSL_MSG("Buffer overflow while formatting key preamble"); ret = 0; - } else { + } + else { if (wolfSSL_BIO_write(bio, line, len) <= 0) { ret = 0; } diff --git a/src/x509.c b/src/x509.c index 27efc1280..7b52cf44f 100644 --- a/src/x509.c +++ b/src/x509.c @@ -6244,10 +6244,12 @@ int wolfSSL_X509_signature_print(WOLFSSL_BIO *bp, return WOLFSSL_FAILURE; } - if ((sigalg->algorithm->obj == NULL) || (sigalg->algorithm->obj[idx++] != ASN_OBJECT_ID)) { + if ((sigalg->algorithm->obj == NULL) || + (sigalg->algorithm->obj[idx] != ASN_OBJECT_ID)) { WOLFSSL_MSG("Bad ASN1 Object"); return WOLFSSL_FAILURE; } + idx++; /* skip object id */ if (GetLength((const byte*)sigalg->algorithm->obj, &idx, &length, sigalg->algorithm->objSz) < 0 || length < 0) { @@ -6262,7 +6264,7 @@ int wolfSSL_X509_signature_print(WOLFSSL_BIO *bp, for (i = 0; i < length; ++i) { char hex_digits[4]; #ifdef XSNPRINTF - XSNPRINTF(hex_digits, sizeof hex_digits, "%c%02X", i>0 ? ':' : ' ', + XSNPRINTF(hex_digits, sizeof(hex_digits), "%c%02X", i>0 ? ':' : ' ', (unsigned int)sigalg->algorithm->obj[idx+i]); #else XSPRINTF(hex_digits, "%c%02X", i>0 ? ':' : ' ',