From 24f4c96f350c55177376d322c3d59b21d3ff5279 Mon Sep 17 00:00:00 2001 From: OmniTroid Date: Mon, 15 May 2017 23:34:47 +0200 Subject: [PATCH] fixed a crash associated with /ip on serverD --- hardware_functions.cpp | 3 +-- packet_distribution.cpp | 10 +++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/hardware_functions.cpp b/hardware_functions.cpp index b566f22..48bd214 100644 --- a/hardware_functions.cpp +++ b/hardware_functions.cpp @@ -15,7 +15,7 @@ QString get_hdid() if (bIsRetrieved) return QString::number(dwVolSerial, 16); else - //literally a random string + //a totally random string //what could possibly go wrong return "gxsps32sa9fnwic92mfbs0"; @@ -30,7 +30,6 @@ QString get_hdid() { QFile fstab_file("/etc/fstab"); if (!fstab_file.open(QIODevice::ReadOnly)) - //literally a random string.... what else are we supposed to do? return "gxcps32sa9fnwic92mfbs0"; QTextStream in(&fstab_file); diff --git a/packet_distribution.cpp b/packet_distribution.cpp index 6c36ff2..9915b3e 100644 --- a/packet_distribution.cpp +++ b/packet_distribution.cpp @@ -206,14 +206,18 @@ void AOApplication::server_packet_received(AOPacket *p_packet) } else if (header == "SI") { - if (f_contents.size() < 3) + if (f_contents.size() != 3) goto end; char_list_size = f_contents.at(0).toInt(); - loaded_chars = 0; evidence_list_size = f_contents.at(1).toInt(); - loaded_evidence = 0; music_list_size = f_contents.at(2).toInt(); + + if (char_list_size < 1 || evidence_list_size < 0 || music_list_size < 0) + goto end; + + loaded_chars = 0; + loaded_evidence = 0; loaded_music = 0; destruct_courtroom();