diff options
author | Max Kellermann <max@duempel.org> | 2016-07-07 13:52:20 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2016-07-07 13:52:20 +0200 |
commit | b46cf57d983e559ebd29c4f0749914f3714d8b75 (patch) | |
tree | 05e84cde2b44d9ffd3055eae60ee6ae7885e4af5 /src/event/BufferedSocket.cxx | |
parent | 6f59d71e0767a3fb84ff9b63555082938c7f4402 (diff) |
event/BufferedSocket: OnSocketReady() returns true after close
Fixes use-after-free bug (https://bugs.musicpd.org/view.php?id=4548).
Diffstat (limited to 'src/event/BufferedSocket.cxx')
-rw-r--r-- | src/event/BufferedSocket.cxx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/event/BufferedSocket.cxx b/src/event/BufferedSocket.cxx index 939824baa..1891f18bb 100644 --- a/src/event/BufferedSocket.cxx +++ b/src/event/BufferedSocket.cxx @@ -118,9 +118,15 @@ BufferedSocket::OnSocketReady(unsigned flags) if (flags & READ) { assert(!input.IsFull()); - if (!ReadToBuffer() || !ResumeInput()) + if (!ReadToBuffer()) return false; + if (!ResumeInput()) + /* we must return "true" here or + SocketMonitor::Dispatch() will call + Cancel() on a freed object */ + return true; + if (!input.IsFull()) ScheduleRead(); } |