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

🐛 fix double free of tlsSocket #159

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

m-unkel
Copy link
Contributor

@m-unkel m-unkel commented Sep 1, 2024

This PR fixes a double free of tlsSocket in a cs104 connection.

Reproduce double free:

  • successfully establish a connection
    -> self->tlsSocket is allocated
  • shut down the slave
    -> connection is closed
    -> self->tlsSocket is freed, but the pointer is not NULLed
  • try to reconnect from the client side
    -> socket connect fails
    -> self->tlsSocket untouched
    -> self->tlsSocket freed again

This fix simple set tlsSocket to NULL once freed.

There is a double free of tlsSocket, if there was a successfull connection once, then the server goes away.
The next time the connection will fail in socket connect and therefore will not overwrite self->tlsSocket and we try to free the already freed tlsSocket from the previous connection again.
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