Kernel: Handle overflow in FileDescription::seek(, SEEK_CUR)

This commit is contained in:
Brian Gianforcaro 2021-02-21 06:23:37 -08:00 committed by Andreas Kling
parent 26bba8e100
commit 2139e0a201

View file

@ -138,6 +138,8 @@ off_t FileDescription::seek(off_t offset, int whence)
new_offset = offset;
break;
case SEEK_CUR:
if (Checked<off_t>::addition_would_overflow(m_current_offset, offset))
return -EOVERFLOW;
new_offset = m_current_offset + offset;
break;
case SEEK_END: