1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 09:28:13 +00:00

Kernel: Fix use-after-free in sys$mremap

Now that Region::name() has been changed to return a StringView we
can't rely on keeping a copy of the region's name past the region's
destruction just by holding a copy of the StringView.
This commit is contained in:
Gunnar Beutner 2021-06-02 11:58:56 +02:00 committed by Andreas Kling
parent 33cdc59dff
commit fe0ae3161a
2 changed files with 4 additions and 2 deletions

View file

@ -68,6 +68,7 @@ public:
bool is_cacheable() const { return m_cacheable; }
StringView name() const { return m_name ? m_name->view() : StringView {}; }
OwnPtr<KString> take_name() { return move(m_name); }
Region::Access access() const { return static_cast<Region::Access>(m_access); }
void set_name(OwnPtr<KString> name) { m_name = move(name); }