Skip to content
Snippets Groups Projects
Commit feb11e4a authored by mattijs's avatar mattijs
Browse files

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

parent 276cef6a
No related branches found
No related tags found
No related merge requests found
...@@ -106,7 +106,14 @@ inline Foam::Istream& Foam::UIPstream::readStringFromBuffer(std::string& str) ...@@ -106,7 +106,14 @@ inline Foam::Istream& Foam::UIPstream::readStringFromBuffer(std::string& str)
size_t len; size_t len;
readFromBuffer(len); readFromBuffer(len);
str.assign(&externalBuf_[externalBufPosition_], len); if (len == 0)
{
str.clear();
}
else
{
str.assign(&externalBuf_[externalBufPosition_], len);
}
externalBufPosition_ += len; externalBufPosition_ += len;
checkEof(); checkEof();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment