fs: Return nullptr when file descriptor is out of bounds. (#1842)

This commit is contained in:
squidbus 2024-12-21 16:49:34 -08:00 committed by GitHub
parent 08182f814f
commit 7e890def48
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -171,6 +171,9 @@ void HandleTable::DeleteHandle(int d) {
File* HandleTable::GetFile(int d) {
std::scoped_lock lock{m_mutex};
if (d < 0 || d >= m_files.size()) {
return nullptr;
}
return m_files.at(d);
}