Kernel: Check for overflow in seek syscall

This commit is contained in:
2026-07-09 23:39:13 +03:00
parent f6e27e5f05
commit 4df58c5155

View File

@@ -376,6 +376,9 @@ namespace Kernel
return BAN::Error::from_errno(EINVAL); return BAN::Error::from_errno(EINVAL);
} }
if (BAN::Math::will_addition_overflow(base_offset, offset))
return BAN::Error::from_errno(EOVERFLOW);
const off_t new_offset = base_offset + offset; const off_t new_offset = base_offset + offset;
if (new_offset < 0) if (new_offset < 0)
return BAN::Error::from_errno(EINVAL); return BAN::Error::from_errno(EINVAL);