Skip to content

Fix #677: Exception in async_server_base/async_connection during port scanning (nmap) #678

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

Closed

Conversation

vovams
Copy link

@vovams vovams commented Aug 10, 2016

Fix for issue #677.

During a port scan async_server_base::handle_accept() may be called while the connection is not properly established. No error code is passed to handel_accept() (i.e. !!ec == false) but the subsequent call to async_connection::start() -> stream_handler::remote_endpoint() -> asio::basic_socket::remote_endpoint() fails with an exception.

My fix is to add error checking by using asio::basic_socket::remote_endpoint(asio::error_code&) overload in stream_handler::remote_endpoint() and passing the error to async_connection::start().

Since i had to change signature of stream_handler::remote_endpoint(), i added a new overload with old signature and behavior to keep any code which uses it working.

@glynos
Copy link
Member

glynos commented Aug 10, 2016

@vovams sorry, the 0.12-release branch is not correct. Please apply the PR to the 0.13-release branch. The PR looks good, though.

@glynos glynos closed this Aug 10, 2016
@vovams
Copy link
Author

vovams commented Aug 11, 2016

I can adapt the fix for 0.13, but what about 0.12? I wanted to merge the fix into it because i am using 0.12 in my project.

@deanberris
Copy link
Member

@glynos -- Do you think it's OK for us to pull this in then release a 0.12.1 to address just this issue?

@glynos
Copy link
Member

glynos commented Aug 11, 2016

@deanberris -- No, we agreed that some changes in 0.12 were mistakenly added, and reverted those changes in 0.13. We are slow to release a 0.13 version, but I think this should be a part of it.

@deanberris
Copy link
Member

Okay, SGTM.

@vovams
Copy link
Author

vovams commented Aug 11, 2016

I do not know your release plans, but branch 0.12-release currently contains some other fixes as well. For example, 79aaa62, because of which i had to switch my project from cpp-netlib-0.12.0-final tag to the tip of 0.12-release. So a bugfix release might be useful.

Anyway, i opened new pull request for 0.13-release: #679.

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.

3 participants