mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-17 03:03:23 +02:00
Fix writing into closed socket from streambuf
In case of error occured in writeToDevice pptr may become one byte farther than epptr. This can lead to crash in streambuf::xsputn from libstdc++.
This commit is contained in:
@@ -73,12 +73,12 @@ public:
|
||||
{
|
||||
if (!(_mode & IOS::out)) return char_traits::eof();
|
||||
|
||||
if (flushBuffer() == std::streamsize(-1)) return char_traits::eof();
|
||||
if (c != char_traits::eof())
|
||||
{
|
||||
*this->pptr() = char_traits::to_char_type(c);
|
||||
this->pbump(1);
|
||||
}
|
||||
if (flushBuffer() == std::streamsize(-1)) return char_traits::eof();
|
||||
|
||||
return c;
|
||||
}
|
||||
@@ -127,7 +127,7 @@ protected:
|
||||
void resetBuffers()
|
||||
{
|
||||
this->setg(_pReadBuffer + 4, _pReadBuffer + 4, _pReadBuffer + 4);
|
||||
this->setp(_pWriteBuffer, _pWriteBuffer + (_bufsize - 1));
|
||||
this->setp(_pWriteBuffer, _pWriteBuffer + _bufsize);
|
||||
}
|
||||
|
||||
private:
|
||||
|
Reference in New Issue
Block a user