Skip to content

Commit d81a08a

Browse files
author
Andras Fekete
committed
Catch error return code and remove redundant condition
1 parent 88f0777 commit d81a08a

1 file changed

Lines changed: 4 additions & 16 deletions

File tree

src/x509.c

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,22 +1545,10 @@ int wolfSSL_X509V3_EXT_print(WOLFSSL_BIO *out, WOLFSSL_X509_EXTENSION *ext,
15451545
WOLFSSL_MSG("Memory error");
15461546
return rc;
15471547
}
1548-
if (sk->next) {
1549-
if ((valLen = XSNPRINTF(val, len, "%*s%s,",
1550-
indent, "", str->strData))
1551-
>= len) {
1552-
XFREE(val, NULL, DYNAMIC_TYPE_TMP_BUFFER);
1553-
return rc;
1554-
}
1555-
} else {
1556-
if ((valLen = XSNPRINTF(val, len, "%*s%s",
1557-
indent, "", str->strData))
1558-
>= len) {
1559-
XFREE(val, NULL, DYNAMIC_TYPE_TMP_BUFFER);
1560-
return rc;
1561-
}
1562-
}
1563-
if ((tmpLen + valLen) >= tmpSz) {
1548+
valLen = XSNPRINTF(val, len, "%*s%s", indent, "",
1549+
str->strData);
1550+
if ((valLen < 0) || (valLen >= len)
1551+
|| ((tmpLen + valLen) >= tmpSz)) {
15641552
XFREE(val, NULL, DYNAMIC_TYPE_TMP_BUFFER);
15651553
return rc;
15661554
}

0 commit comments

Comments
 (0)