From 17411e6b4499f57e2460cacb6b14765e5beef88f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Fri, 6 Jan 2017 23:09:17 +0100 Subject: Fix an use-after-free MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Because we “delete all node” and then we use the content of one of these nodes we got earlier. --- louloulibs/xmpp/adhoc_command.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'louloulibs') diff --git a/louloulibs/xmpp/adhoc_command.cpp b/louloulibs/xmpp/adhoc_command.cpp index 08d2d17..825cc92 100644 --- a/louloulibs/xmpp/adhoc_command.cpp +++ b/louloulibs/xmpp/adhoc_command.cpp @@ -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; } } -- cgit v1.2.3