Skip to content

fix: avoid never ending loop when peer sends close notify during TLS handshake#143

Open
felipeek wants to merge 1 commit intowildfly-security:mainfrom
felipeek:FixInfiniteLoopWhenPeerSendsCloseNotify2
Open

fix: avoid never ending loop when peer sends close notify during TLS handshake#143
felipeek wants to merge 1 commit intowildfly-security:mainfrom
felipeek:FixInfiniteLoopWhenPeerSendsCloseNotify2

Conversation

@felipeek
Copy link

@felipeek felipeek commented Sep 6, 2024

When acting as a client, if the peer sends a closeNotify message during the TLS handshake, a bug may occur in which wildfly becomes stuck in the unwrap or wrap functions. This happens because the underlying sslEngine.[un]wrap functions eventually return a result with status CLOSED and with 0 bytes consumed, but the caller does not handle it properly, and simply proceed to the next iteration even though no data was consumed.

This issue is easily reproduced by setting up a custom TLS server that forcefully emits closeNotify messages during the handshake, using wildfly engine as a client connection, and observing the behavior.

The proposed modifications seem to fix the issue.

@felipeek
Copy link
Author

felipeek commented Oct 9, 2025

Hi @fjuma and @Skyllarr , could you take a look at this tiny bug fix when possible? Appreciate it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant