kernel: Properly initialize the shebang read buffer with zeros
Some checks failed
Build and test / build (push) Failing after 11m23s
Some checks failed
Build and test / build (push) Failing after 11m23s
Before this patch, a shebang line that was too long could have left the buffer without a null terminator, allowing some other stack contents to pass into the m_interpreter_cmdline.
This commit is contained in:
parent
e2ff0ad273
commit
b59a787b9e
@ -16,6 +16,8 @@ Result<bool> ScriptLoader::sniff()
|
||||
Result<u64> ScriptLoader::load(AddressSpace* space)
|
||||
{
|
||||
u8 buf[256];
|
||||
memset(buf, 0, sizeof(buf));
|
||||
|
||||
usize nread = TRY(m_inode->read(buf, 2, 255));
|
||||
if (!nread) return err(ENOEXEC);
|
||||
for (usize i = 0; i < nread; i++)
|
||||
|
Loading…
Reference in New Issue
Block a user