Fix #677: Exception in async_server_base/async_connection during port scanning (nmap)#678
Fix #677: Exception in async_server_base/async_connection during port scanning (nmap)#678vovams wants to merge 1 commit intocpp-netlib:0.12-releasefrom
Conversation
|
@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. |
|
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. |
|
@glynos -- Do you think it's OK for us to pull this in then release a 0.12.1 to address just this issue? |
|
@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. |
|
Okay, SGTM. |
|
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. |
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 tohandel_accept()(i.e.!!ec == false) but the subsequent call toasync_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 instream_handler::remote_endpoint()and passing the error toasync_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.