Skip to content

Commit 4a5b846

Browse files
authored
Fix infinite loop during TLS handshake(Only .NET6) (#583)
Fix infinite loop caused by disconnection during TLS handshake, and the memory exploded instantly.
1 parent 18fbb08 commit 4a5b846

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/DotNetty.Handlers/Tls/TlsHandler.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,13 @@ void Unwrap(
506506
}
507507

508508
int read = currentReadFuture.Result;
509+
510+
if (read == 0)
511+
{
512+
//Stream closed
513+
return;
514+
}
515+
509516
AddBufferToOutput(outputBuffer, read, output);
510517
}
511518

@@ -763,4 +770,4 @@ static class TlsHandlerStateExtensions
763770

764771
public static bool HasAny(this TlsHandlerState value, TlsHandlerState testValue) => (value & testValue) != 0;
765772
}
766-
}
773+
}

0 commit comments

Comments
 (0)