From 292b9a7d835768fcb867979055e471f49dbbb9cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Obiltschnig?= Date: Mon, 7 Feb 2022 18:13:31 +0100 Subject: [PATCH] #3465: NetSSL_Win: bad error handling when decodeMessage() fails --- NetSSL_Win/src/SecureSocketImpl.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/NetSSL_Win/src/SecureSocketImpl.cpp b/NetSSL_Win/src/SecureSocketImpl.cpp index 78f55adb9..74e00e701 100644 --- a/NetSSL_Win/src/SecureSocketImpl.cpp +++ b/NetSSL_Win/src/SecureSocketImpl.cpp @@ -657,16 +657,16 @@ SECURITY_STATUS SecureSocketImpl::decodeBufferFull(BYTE* pBuffer, DWORD bufSize, } else { - // everything decoded - if (securityStatus != SEC_E_OK && securityStatus != SEC_E_INCOMPLETE_MESSAGE && securityStatus != SEC_I_RENEGOTIATE && securityStatus != SEC_I_CONTEXT_EXPIRED) - { - throw SSLException("Failed to decode data", Utility::formatError(securityStatus)); - } - else if (securityStatus == SEC_E_OK) + if (securityStatus == SEC_E_OK) { + // everything decoded pBuffer = 0; bufSize = 0; } + else if (securityStatus != SEC_E_INCOMPLETE_MESSAGE && securityStatus != SEC_I_RENEGOTIATE && securityStatus != SEC_I_CONTEXT_EXPIRED) + { + return securityStatus; + } } if (securityStatus == SEC_I_RENEGOTIATE)