Fix an use-after-free
Because we “delete all node” and then we use the content of one of these nodes we got earlier.
This commit is contained in:
@@ -54,10 +54,11 @@ void HelloStep2(XmppComponent&, AdhocSession& session, XmlNode& command_node)
|
|||||||
{
|
{
|
||||||
if (const XmlNode* value = name_field->get_child("value", "jabber:x:data"))
|
if (const XmlNode* value = name_field->get_child("value", "jabber:x:data"))
|
||||||
{
|
{
|
||||||
|
const std::string value_str = value->get_inner();
|
||||||
command_node.delete_all_children();
|
command_node.delete_all_children();
|
||||||
XmlSubNode note(command_node, "note");
|
XmlSubNode note(command_node, "note");
|
||||||
note["type"] = "info";
|
note["type"] = "info";
|
||||||
note.set_inner("Hello "s + value->get_inner() + "!"s);
|
note.set_inner("Hello "s + value_str + "!"s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user