From c8f5bd3d6199ef8fecb4f284a1241c254974f788 Mon Sep 17 00:00:00 2001 From: Kareem Date: Wed, 6 Jul 2022 12:09:47 -0700 Subject: [PATCH] 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. --- src/ssl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ssl.c b/src/ssl.c index ccb5d6777..d134dd51b 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -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. */