From 4140a3339aad886be0287c17bd4eabe7597af8e9 Mon Sep 17 00:00:00 2001 From: in1tiate Date: Sun, 28 Mar 2021 23:11:22 -0500 Subject: [PATCH 1/2] fix packets containing unencoded newlines being incorrectly split into multiple entries --- src/demoserver.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/demoserver.cpp b/src/demoserver.cpp index 88dfdb4..509a356 100644 --- a/src/demoserver.cpp +++ b/src/demoserver.cpp @@ -233,8 +233,9 @@ void DemoServer::load_demo(QString filename) demo_stream.setCodec("UTF-8"); QString line = demo_stream.readLine(); while (!line.isNull()) { - if (!line.endsWith("%")) { + while (!line.endsWith("%")) { line += "\n"; + line += demo_stream.readLine(); } demo_data.enqueue(line); line = demo_stream.readLine(); From 05ff6b08a2d7a812ae128e23c97a516f2492cfe9 Mon Sep 17 00:00:00 2001 From: in1tiate Date: Sun, 28 Mar 2021 23:11:54 -0500 Subject: [PATCH 2/2] add exception for LE packets in demos, which encode ampersand separators --- src/packet_distribution.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp index f3810ca..0a99b9d 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -542,7 +542,11 @@ void AOApplication::server_packet_received(AOPacket *p_packet) QVector f_evi_list; for (QString f_string : f_contents_encoded) { - QStringList sub_contents = f_string.split("&"); + QStringList sub_contents; + if (f_contents_encoded.contains("&")) + sub_contents = f_string.split("&"); + else + sub_contents = f_string.split(""); // demos incorrectly encode the separator so we have to account for that if (sub_contents.size() < 3) continue;