Commit feb11e4a authored by mattijs's avatar mattijs
Browse files

BUG: UIPstream: sending zero sized string accesses beyond buffer. Fixes #676

parent 276cef6a
......@@ -106,7 +106,14 @@ inline Foam::Istream& Foam::UIPstream::readStringFromBuffer(std::string& str)
size_t len;
readFromBuffer(len);
str.assign(&externalBuf_[externalBufPosition_], len);
if (len == 0)
{
str.clear();
}
else
{
str.assign(&externalBuf_[externalBufPosition_], len);
}
externalBufPosition_ += len;
checkEof();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment