Fix storage of SendBuffered's return code in wolfSSL_Connect. Store in ret initially, only store in ssl->error if there's an error. This matches the logic in wolfSSL_accept.

This commit is contained in:
Kareem
2022-07-06 12:09:47 -07:00
parent b2d1bf96ed
commit c8f5bd3d61

View File

@ -11983,7 +11983,8 @@ int wolfSSL_DTLS_SetCookieSecret(WOLFSSL* ssl,
&& ssl->error != WC_PENDING_E
#endif
) {
if ( (ssl->error = SendBuffered(ssl)) == 0) {
ret = SendBuffered(ssl);
if (ret == 0) {
if (ssl->fragOffset == 0 && !ssl->options.buildingMsg) {
if (advanceState) {
ssl->options.connectState++;
@ -12501,7 +12502,8 @@ int wolfSSL_DTLS_SetCookieSecret(WOLFSSL* ssl,
&& ssl->error != WC_PENDING_E
#endif
) {
if ( (ret = SendBuffered(ssl)) == 0) {
ret = SendBuffered(ssl);
if (ret == 0) {
/* fragOffset is non-zero when sending fragments. On the last
* fragment, fragOffset is zero again, and the state can be
* advanced. */