1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-11 10:18:15 +09:00
ladybird/Libraries/LibIPC/UnprocessedFileDescriptors.h
Aliaksandr Kalenik ac643aa392 LibIPC: Break from message parsing if whole message payload is not ready
Fixes the bug when we try to read message payload without checking if we
received enough bytes or file descriptors.
2025-04-07 20:26:01 +02:00

36 lines
559 B
C++

/*
* Copyright (c) 2025, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibIPC/File.h>
namespace IPC {
class UnprocessedFileDescriptors {
public:
void enqueue(File&& fd)
{
m_fds.append(move(fd));
}
File dequeue()
{
return m_fds.take_first();
}
void return_fds_to_front_of_queue(Vector<File>&& fds)
{
m_fds.prepend(move(fds));
}
size_t size() const { return m_fds.size(); }
private:
Vector<File> m_fds;
};
}