mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-13 10:32:57 +01:00
NetSSL_Win: fix potential endless loop due to wrong error handling
This commit is contained in:
parent
1d16cb115b
commit
5a5e8584f9
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user