Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TOCTOU race between Quit() and reconnection #100

Open
slingamn opened this issue Nov 9, 2023 · 0 comments
Open

TOCTOU race between Quit() and reconnection #100

slingamn opened this issue Nov 9, 2023 · 0 comments

Comments

@slingamn
Copy link
Member

slingamn commented Nov 9, 2023

  1. We check irc.quit at the start of Connect():

    irc-go/ircevent/irc.go

    Lines 615 to 617 in 5474a63

    if irc.quit {
    return ClientHasQuit // check this again in case of Quit() while we were asleep
    }
  2. This check can succeed and then Quit() can be called concurrently with the actual dial call
  3. The client will reconnect to the server and renegotiate, but will eventually be disconnected by the serverDidNotQuit check (we will think that we sent QUIT, so we'll wait for the server to disconnect us, but we won't wait forever)

We should probably just check irc.quit again after the dial succeeds, and if so, hang up.

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

No branches or pull requests

1 participant