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

http: fix ptr of conn and request at req_close #46

Merged
merged 2 commits into from
Dec 2, 2020

Conversation

cHuberCoffee
Copy link
Contributor

The request of the connection must be set to NULL at req_close.

Wrong checks in conn_idle would lead to not start the idle_timeout
and the request of the connection would not be set to NULL.
At TCP connection close, close_handler & try_next is called with
ECONNRESET. This would lead to a ptr deref in try_next of conn->req
which is valid data, but the req itself is not valid anymore.
conn_req is not a NULL ptr so the check if (!req) is not effective.
Following the next line, one sets a nonvalid data segment (req->conn) -> SEGV.

The request of the connection must be set to NULL at req_close.

Wrong checks in conn_idle would lead to not start the idle_timeout
and the request of the connection would not be set to NULL.
At TCP connection close, close_handler & try_next is called with
ECONNRESET. This would lead to a ptr deref in try_next of conn->req
which is valid data, but the req itself is not valid anymore.
conn_req is not a NULL ptr so the check if (!req) is not effective.
Following the next line, one sets a nonvalid data segment (req->conn) -> SEGV.
src/http/client.c Outdated Show resolved Hide resolved
@sreimers sreimers merged commit bcb56f7 into baresip:master Dec 2, 2020
@cHuberCoffee cHuberCoffee deleted the http_client_conn_idle_fix branch December 2, 2020 10:59
@sreimers sreimers added the bug Something isn't working label Apr 9, 2021
@sreimers sreimers added this to the v2.0.0 milestone Apr 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants