~singpolyma/biboumi

17411e6b4499f57e2460cacb6b14765e5beef88f — louiz’ 6 years ago 5b56007
Fix an use-after-free

Because we “delete all node” and then we use the content of one of these
nodes we got earlier.
1 files changed, 2 insertions(+), 1 deletions(-)

M louloulibs/xmpp/adhoc_command.cpp
M louloulibs/xmpp/adhoc_command.cpp => louloulibs/xmpp/adhoc_command.cpp +2 -1
@@ 54,10 54,11 @@ void HelloStep2(XmppComponent&, AdhocSession& session, XmlNode& command_node)
        {
          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();
              XmlSubNode note(command_node, "note");
              note["type"] = "info";
              note.set_inner("Hello "s + value->get_inner() + "!"s);
              note.set_inner("Hello "s + value_str + "!"s);
              return;
            }
        }