From 7b88d4be954b415e069ee0d612e4df3793c61756 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sat, 30 Jul 2022 19:42:22 +0300 Subject: Never send an unencoded packet to the server (#719) * never send an unencoded packet to the server * oops * Improve packet validation to remove segfaults * WARNING: commit breaks connecting to servers, need help start fixing omniwhy caused by single fuckin string packets (AAAAAAAAAAAAAAAAA) * Fix failed connections to servers (Thanks to @Iuvee for helping me figure this out!) * Fix demoserver * who the fuck still uses goto Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * ANOTHER GOTO???? Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * braces Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * good bot Update src/packet_distribution.cpp Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Fix demoserver harder * Improve demo logging * Fix memory leakage by deleting the packet Fix useless demoserver wait packet creation when none of that packet is used Co-authored-by: stonedDiscord Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Salanto <62221668+Salanto@users.noreply.github.com> --- include/aoapplication.h | 2 +- include/aopacket.h | 4 ++-- include/demoserver.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/aoapplication.h b/include/aoapplication.h index ce74215..21c04b8 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -78,7 +78,7 @@ public: void server_packet_received(AOPacket *p_packet); - void send_server_packet(AOPacket *p_packet, bool encoded = true); + void send_server_packet(AOPacket *p_packet); void call_settings_menu(); void call_announce_menu(Courtroom *court); diff --git a/include/aopacket.h b/include/aopacket.h index a325103..d5baccb 100644 --- a/include/aopacket.h +++ b/include/aopacket.h @@ -7,8 +7,8 @@ class AOPacket { public: - AOPacket(QString p_packet_string); - AOPacket(QString header, QStringList &p_contents) : m_header(header), m_contents(p_contents){} + AOPacket(QString header) : m_header(header){} + AOPacket(QString header, QStringList p_contents) : m_header(header), m_contents(p_contents){} QString get_header() { return m_header; } QStringList &get_contents() { return m_contents; } diff --git a/include/demoserver.h b/include/demoserver.h index d355ddb..bb0baed 100644 --- a/include/demoserver.h +++ b/include/demoserver.h @@ -23,7 +23,7 @@ public: int max_wait = -1; private: - void handle_packet(AOPacket packet); + void handle_packet(AOPacket *packet); void load_demo(QString filename); void reset_state(); -- cgit