Skip to content

Commit

Permalink
Fixed potential UB
Browse files Browse the repository at this point in the history
this pointer needs to be duplicated because accepted_versions_ change
e.g. from load_config() could invalidate it
  • Loading branch information
loonycyborg committed Jan 12, 2021
1 parent a452fdc commit de6489d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/server/wesnothd/server.cpp
Expand Up @@ -651,7 +651,7 @@ void server::login_client(boost::asio::yield_context yield, socket_ptr socket)
<< ":\trejecting them\n";

// For compatibility with older clients
response.set_attr("version", accepted_versions_.begin()->c_str());
response.set_attr_dup("version", accepted_versions_.begin()->c_str());

simple_wml::node& reject = response.root().add_child("reject");
reject.set_attr_dup("accepted_versions", utils::join(accepted_versions_).c_str());
Expand Down

0 comments on commit de6489d

Please sign in to comment.