diff options
Diffstat (limited to 'src/messagein.cpp')
-rw-r--r-- | src/messagein.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/messagein.cpp b/src/messagein.cpp index 2559f7fb..f5ae44db 100644 --- a/src/messagein.cpp +++ b/src/messagein.cpp @@ -104,8 +104,9 @@ std::string MessageIn::readString(int length) } // Read the string - int stringLength = strnlen(mPacket->data + mPos, length); - std::string readString(mPacket->data + mPos, stringLength); + char const *stringBeg = mPacket->data + mPos, + *stringEnd = (char const *)memchr(stringBeg, '\0', length); + std::string readString(stringBeg, stringEnd ? stringEnd - stringBeg : length); mPos += length; return readString; } |