summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-06 00:51:01 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-06 02:02:31 +0300
commit1c00cf20fb58492489f8137161c552fe4d70d2cb (patch)
treecbe6d7a04f0582aa55f81bcaa28a68011c582efc /src/net
parentc1b0e49636cbc2a08f7690c33a6367542f6857b3 (diff)
downloadplus-1c00cf20fb58492489f8137161c552fe4d70d2cb.tar.gz
plus-1c00cf20fb58492489f8137161c552fe4d70d2cb.tar.bz2
plus-1c00cf20fb58492489f8137161c552fe4d70d2cb.tar.xz
plus-1c00cf20fb58492489f8137161c552fe4d70d2cb.zip
eathena: read whole packet in processAddQuestsObjectives.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/eathena/questhandler.cpp1
-rw-r--r--src/net/messagein.cpp11
-rw-r--r--src/net/messagein.h2
3 files changed, 14 insertions, 0 deletions
diff --git a/src/net/eathena/questhandler.cpp b/src/net/eathena/questhandler.cpp
index 3d6cde34f..d7e8bf6e8 100644
--- a/src/net/eathena/questhandler.cpp
+++ b/src/net/eathena/questhandler.cpp
@@ -141,6 +141,7 @@ void QuestHandler::processAddQuestsObjectives(Net::MessageIn &msg)
msg.readString(24, "monster name");
}
}
+ msg.skipToEnd("unused");
}
void QuestHandler::processUpdateQuestsObjectives(Net::MessageIn &msg)
diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp
index 0c7f9cb7e..212ce9d55 100644
--- a/src/net/messagein.cpp
+++ b/src/net/messagein.cpp
@@ -200,6 +200,17 @@ void MessageIn::skip(const unsigned int length, const char *const str)
PacketCounters::incInBytes(length);
}
+void MessageIn::skipToEnd(const char *const str)
+{
+ const int diff = static_cast<int>(mLength - mPos);
+ if (diff)
+ {
+ DEBUGLOG2("skip: " + toString(diff), mPos, str);
+ mPos = mLength;
+ PacketCounters::incInBytes(diff);
+ }
+}
+
std::string MessageIn::readString(int length, const char *const dstr)
{
// Get string length
diff --git a/src/net/messagein.h b/src/net/messagein.h
index cc32328cb..ba857ce64 100644
--- a/src/net/messagein.h
+++ b/src/net/messagein.h
@@ -97,6 +97,8 @@ class MessageIn notfinal
virtual void skip(const unsigned int length,
const char *const str = nullptr);
+ void skipToEnd(const char *const str = nullptr);
+
/**
* Reads a string. If a length is not given (-1), it is assumed
* that the length of the string is stored in a short at the