diff --git a/NetSSL_Win/src/SecureSocketImpl.cpp b/NetSSL_Win/src/SecureSocketImpl.cpp index 8bcaa7516..7eff2838c 100644 --- a/NetSSL_Win/src/SecureSocketImpl.cpp +++ b/NetSSL_Win/src/SecureSocketImpl.cpp @@ -552,10 +552,10 @@ SECURITY_STATUS SecureSocketImpl::decodeMessage(BYTE* pBuffer, DWORD bufSize, Au { for (int i = 1; i < 4; ++i) { - if (pDataBuffer == 0 && msg[i].BufferType == SECBUFFER_DATA) + if (!pDataBuffer && msg[i].BufferType == SECBUFFER_DATA) pDataBuffer = &msg[i]; - if (pExtraBuffer == NULL && msg[i].BufferType == SECBUFFER_EXTRA) + if (!pExtraBuffer && msg[i].BufferType == SECBUFFER_EXTRA) pExtraBuffer = &msg[i]; } } @@ -631,16 +631,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)