From 2541eba8c2c01ddf25e6cc08d39b99f056a22948 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 4 Oct 2023 01:40:27 +0300 Subject: [PATCH 1/2] Terminate wrong connections to map server after two first bytes received --- src/map/clif.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/map/clif.c b/src/map/clif.c index 0f21ec328f0..38fd5e3f98f 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -26154,8 +26154,17 @@ static int clif_parse(int fd) } } - if ((int)RFIFOREST(fd) < packet_len) + if ((int)RFIFOREST(fd) < packet_len) { + if (sd == NULL) { + if (packet_db[cmd].func != clif->pWantToConnection) { + ShowWarning("clif_parse: Received first unsupported packet (packet 0x%04x (0x%04x), %"PRIuS" bytes received), disconnecting session #%d.\n", + (unsigned int)cmd, RFIFOW(fd, 0), RFIFOREST(fd), fd); + sockt->eof(fd); + } + } + return 0; // not enough data received to form the packet + } if( battle_config.packet_obfuscation == 2 || cmd != RFIFOW(fd, 0) || (sd && sd->parse_cmd_func == clif->parse_cmd_decrypt) ) { // Note: Overriding const qualifier to re-inject the decoded packet ID. From 194dce64858a8f947075bdfab1159a90ea98a367 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 4 Nov 2023 23:47:28 +0300 Subject: [PATCH 2/2] Fix error detection in running server from warning by maria db --- tools/ci/travis.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ci/travis.sh b/tools/ci/travis.sh index c24025deb0c..6186d1b5de3 100755 --- a/tools/ci/travis.sh +++ b/tools/ci/travis.sh @@ -52,7 +52,7 @@ function run_server { rm -rf core* || true CRASH_PLEASE=1 $1 --run-once $2 2>runlog.txt export errcode=$? - export teststr=$(head -c 10000 runlog.txt) + export teststr=$(head -c 10000 runlog.txt|grep -v "WARNING: MYSQL_OPT_RECONNECT is deprecated and will be removed in a future version.") if [[ -n "${teststr}" ]]; then echo "Errors found in running server $1." head -c 10000 runlog.txt