mirror of
https://github.com/LibreOffice/online.git
synced 2025-08-01 16:04:55 +00:00
Crop socket buffer removal to socket buffer size & warn.
Change-Id: I734b4682941d71eee02a25aab61c8e4353a11718 Reviewed-on: https://gerrit.libreoffice.org/69948 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
This commit is contained in:
@ -932,7 +932,11 @@ public:
|
||||
/// Remove the first @count bytes from input buffer
|
||||
void eraseFirstInputBytes(size_t count)
|
||||
{
|
||||
_inBuffer.erase(_inBuffer.begin(), _inBuffer.begin() + count);
|
||||
size_t toErase = std::min(count, _inBuffer.size());
|
||||
if (toErase < count)
|
||||
LOG_ERR("#" << getFD() << ": attempted to remove: " << count << " which is > size: " << _inBuffer.size() << " clamped to " << toErase);
|
||||
if (toErase > 0)
|
||||
_inBuffer.erase(_inBuffer.begin(), _inBuffer.begin() + count);
|
||||
}
|
||||
|
||||
/// Detects if we have an HTTP header in the provided message and
|
||||
|
Reference in New Issue
Block a user