summaryrefslogtreecommitdiff
path: root/louloulibs
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2017-01-06 23:09:17 +0100
committerlouiz’ <louiz@louiz.org>2017-01-06 23:09:17 +0100
commit17411e6b4499f57e2460cacb6b14765e5beef88f (patch)
tree3a92ebfe24f27694eee26a6ca044a82be00a891c /louloulibs
parent5b56007828f20c763df3f36ceed809188880663e (diff)
downloadbiboumi-17411e6b4499f57e2460cacb6b14765e5beef88f.tar.gz
biboumi-17411e6b4499f57e2460cacb6b14765e5beef88f.tar.bz2
biboumi-17411e6b4499f57e2460cacb6b14765e5beef88f.tar.xz
biboumi-17411e6b4499f57e2460cacb6b14765e5beef88f.zip
Fix an use-after-free
Because we “delete all node” and then we use the content of one of these nodes we got earlier.
Diffstat (limited to 'louloulibs')
-rw-r--r--louloulibs/xmpp/adhoc_command.cpp3
1 files changed, 2 insertions, 1 deletions
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;
}
}