aboutsummaryrefslogtreecommitdiff
path: root/src/utility.h
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-04-10 04:15:10 +0300
committerPerttu Ahola <celeron55@gmail.com>2011-04-10 04:15:10 +0300
commitfd7a0735c9aeaa7978190049319e3cdfe48920a4 (patch)
tree655709280d2940de54bd489a24821a158cea787d /src/utility.h
parentc0f0c6568bb45350e65f31476578feff879831bf (diff)
downloaddragonfireclient-fd7a0735c9aeaa7978190049319e3cdfe48920a4.tar.xz
new object system
Diffstat (limited to 'src/utility.h')
-rw-r--r--src/utility.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/utility.h b/src/utility.h
index 3640b4b51..2b143f0ba 100644
--- a/src/utility.h
+++ b/src/utility.h
@@ -1839,15 +1839,17 @@ inline std::string serializeString(const std::string plain)
return s;
}
-// Reads a string with the length as the first two bytes
+/*// Reads a string with the length as the first two bytes
inline std::string deSerializeString(const std::string encoded)
{
u16 s_size = readU16((u8*)&encoded.c_str()[0]);
+ if(s_size > encoded.length() - 2)
+ return "";
std::string s;
s.reserve(s_size);
s.append(&encoded.c_str()[2], s_size);
return s;
-}
+}*/
// Reads a string with the length as the first two bytes
inline std::string deSerializeString(std::istream &is)
@@ -1878,15 +1880,17 @@ inline std::string serializeLongString(const std::string plain)
return s;
}
-// Reads a string with the length as the first four bytes
+/*// Reads a string with the length as the first four bytes
inline std::string deSerializeLongString(const std::string encoded)
{
u32 s_size = readU32((u8*)&encoded.c_str()[0]);
+ if(s_size > encoded.length() - 4)
+ return "";
std::string s;
s.reserve(s_size);
- s.append(&encoded.c_str()[2], s_size);
+ s.append(&encoded.c_str()[4], s_size);
return s;
-}
+}*/
// Reads a string with the length as the first four bytes
inline std::string deSerializeLongString(std::istream &is)