Skip to content

Commit

Permalink
wsd: net: check for unexpected errors in SSL
Browse files Browse the repository at this point in the history
Log and clear them if the SSL API had returned success.

Change-Id: I3ff78eea9fe7cf101f5291cc376d7b566b06558f
Signed-off-by: Ashod Nakashian <[email protected]>
  • Loading branch information
Ashod authored and mmeeks committed Jan 10, 2025
1 parent 7f19872 commit 86203fc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions net/SslSocket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,16 @@ class SslStreamSocket final : public StreamSocket

if (rc > 0)
{
const unsigned long bioError = ERR_peek_error();
if (bioError != 0)
{
LOG_DBG("Unexpected SSL error ("
<< bioError
<< ") after success implies uncleared earlier errors or "
"a bug in the SSL library");
ERR_clear_error();
}

// Success: Reset so we can do either.
_sslWantsTo = SslWantsTo::Neither;
return rc;
Expand Down

0 comments on commit 86203fc

Please sign in to comment.