diff options
author | mekolat <mekolat@users.noreply.github.com> | 2016-07-05 13:08:38 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-05 13:08:38 -0400 |
commit | b042d4bdead7fbfa73f6542d2fe0c087f371d9f9 (patch) | |
tree | 831285f71a0bd6eb0bb616755620d23d71c2fe5d /src/map/clif.cpp | |
parent | 4b79c22885a32b50b9aa0846eb89961543b5a59e (diff) | |
parent | 74f183d739f9a5df2f6c7f596363cf7bec99918e (diff) | |
download | tmwa-b042d4bdead7fbfa73f6542d2fe0c087f371d9f9.tar.gz tmwa-b042d4bdead7fbfa73f6542d2fe0c087f371d9f9.tar.bz2 tmwa-b042d4bdead7fbfa73f6542d2fe0c087f371d9f9.tar.xz tmwa-b042d4bdead7fbfa73f6542d2fe0c087f371d9f9.zip |
Merge pull request #229 from mekolat/freeyorp/emote-patch
fix emote spam crash
Diffstat (limited to 'src/map/clif.cpp')
-rw-r--r-- | src/map/clif.cpp | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/src/map/clif.cpp b/src/map/clif.cpp index 94a6dd1..0bc6b8a 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -5796,37 +5796,36 @@ void clif_parse(Session *s) // dispatches to actual function // if error, close socket - dumb_ptr<map_session_data> sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s->session_data.get())); + uint16_t packet_id; + RecvResult rv = RecvResult::Complete; + dumb_ptr<map_session_data> sd; - if (!sd || (sd && !sd->state.auth)) + while (rv == RecvResult::Complete && packet_peek_id(s, &packet_id)) { - uint16_t packet_id; - if (!packet_peek_id(s, &packet_id)) - return; + sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s->session_data.get())); + + if (!sd || (sd && !sd->state.auth)) + { + if (packet_id != 0x0072 && packet_id != 0x7530) + { + // first packet must be auth or finger + s->set_eof(); + return; + } + } - if (packet_id != 0x0072 && packet_id != 0x7530) + if (!chrif_isconnect()) { - // first packet must be auth or finger s->set_eof(); return; } - } - if (!chrif_isconnect()) - { - s->set_eof(); - return; - } - if (sd && sd->state.auth == 1 && sd->state.waitingdisconnect == 1) - { - packet_discard(s, packet_avail(s)); - return; - } + if (sd && sd->state.auth == 1 && sd->state.waitingdisconnect == 1) + { + packet_discard(s, packet_avail(s)); + return; + } - uint16_t packet_id; - RecvResult rv = RecvResult::Complete; - while (rv == RecvResult::Complete && packet_peek_id(s, &packet_id)) - { switch (packet_id) { case 0x7530: |