summaryrefslogtreecommitdiff
path: root/src/net/eathena/network.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-31 21:18:25 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-06 01:18:54 +0300
commitce61f9fea632400ad5e5500f6592cfc3b3dbef39 (patch)
tree84c8a3d57227cd6eb96052151448edf37d73951e /src/net/eathena/network.cpp
parent09f17e5add2fd2fd0b8c907fda6e3b6c0c010f49 (diff)
downloadmanaplus-ce61f9fea632400ad5e5500f6592cfc3b3dbef39.tar.gz
manaplus-ce61f9fea632400ad5e5500f6592cfc3b3dbef39.tar.bz2
manaplus-ce61f9fea632400ad5e5500f6592cfc3b3dbef39.tar.xz
manaplus-ce61f9fea632400ad5e5500f6592cfc3b3dbef39.zip
eathena: add missing check for packet id.
Diffstat (limited to 'src/net/eathena/network.cpp')
-rw-r--r--src/net/eathena/network.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/net/eathena/network.cpp b/src/net/eathena/network.cpp
index 71eaf4181..fe13b2f86 100644
--- a/src/net/eathena/network.cpp
+++ b/src/net/eathena/network.cpp
@@ -144,9 +144,17 @@ bool Network::messageReady()
{
const int msgId = readWord(0);
if (msgId == SMSG_UPDATE_HOST2)
+ {
len = -1;
+ }
else
- len = packet_lengths[msgId];
+ {
+ if (msgId >= 0 && static_cast<unsigned int>(msgId)
+ < packet_lengths_size)
+ {
+ len = packet_lengths[msgId];
+ }
+ }
if (len == -1 && mInSize > 4)
len = readWord(2);