1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:58:11 +00:00

Kernel: Strip SUID+SGID bits from file when written to or chowned

Fixes #1624.
This commit is contained in:
Andreas Kling 2020-04-04 19:46:55 +02:00
parent 040ba77d44
commit 53d0ca2ad8
6 changed files with 36 additions and 0 deletions

View file

@ -207,6 +207,10 @@ ssize_t TmpFSInode::write_bytes(off_t offset, ssize_t size, const u8* buffer, Fi
ASSERT(!is_directory());
ASSERT(offset >= 0);
auto result = prepare_to_write_data();
if (result.is_error())
return result;
off_t old_size = m_metadata.size;
off_t new_size = m_metadata.size;
if ((offset + size) > new_size)