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 8b7b22e commit 99c7bd3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/server/server.cpp
Expand Up @@ -657,7 +657,7 @@ void server::read_version(socket_ptr socket, std::shared_ptr<simple_wml::documen
<< ":\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 99c7bd3

Please sign in to comment.