mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 18:02:05 -05:00
LibCore+Userland: Use StringViews when calling Core::System::open
For some reason we used raw char pointers sometimes, which caused at least one heap buffer overflow detected in fuzzing.
This commit is contained in:
parent
7dd3c5c981
commit
69218b92a5
3 changed files with 3 additions and 3 deletions
|
@ -185,7 +185,7 @@ ErrorOr<void> File::open_path(StringView filename, mode_t permissions)
|
|||
VERIFY(m_fd == -1);
|
||||
auto flags = open_mode_to_options(m_mode);
|
||||
|
||||
m_fd = TRY(System::open(filename.characters_without_null_termination(), flags, permissions));
|
||||
m_fd = TRY(System::open(filename, flags, permissions));
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ HardwareScreenBackend::HardwareScreenBackend(String device)
|
|||
|
||||
ErrorOr<void> HardwareScreenBackend::open()
|
||||
{
|
||||
m_framebuffer_fd = TRY(Core::System::open(m_device.characters(), O_RDWR | O_CLOEXEC));
|
||||
m_framebuffer_fd = TRY(Core::System::open(m_device, O_RDWR | O_CLOEXEC));
|
||||
|
||||
GraphicsConnectorProperties properties;
|
||||
if (graphics_connector_get_properties(m_framebuffer_fd, &properties) < 0)
|
||||
|
|
|
@ -105,7 +105,7 @@ ErrorOr<Result> benchmark(String const& filename, int file_size, ByteBuffer& buf
|
|||
if (!allow_cache)
|
||||
flags |= O_DIRECT;
|
||||
|
||||
int fd = TRY(Core::System::open(filename.characters(), flags, 0644));
|
||||
int fd = TRY(Core::System::open(filename, flags, 0644));
|
||||
|
||||
auto fd_cleanup = ScopeGuard([fd, filename] {
|
||||
auto void_or_error = Core::System::close(fd);
|
||||
|
|
Loading…
Add table
Reference in a new issue