mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-01 16:58:52 +00:00
Kernel: Allow empty strings in validate_and_copy_string_from_user()
Sergey pointed out that we should just allow empty strings everywhere.
This commit is contained in:
parent
69de90a625
commit
2bf11b8348
Notes:
sideshowbarker
2024-07-19 09:50:15 +09:00
Author: https://github.com/awesomekling
Commit: 2bf11b8348
1 changed files with 5 additions and 8 deletions
|
@ -1163,13 +1163,10 @@ int Process::sys$execve(const Syscall::SC_execve_params* user_params)
|
|||
strings.resize(list.length);
|
||||
copy_from_user(strings.data(), list.strings, list.length * sizeof(Syscall::StringArgument));
|
||||
for (size_t i = 0; i < list.length; ++i) {
|
||||
if (strings[i].length == 0) {
|
||||
output.append(String::empty());
|
||||
continue;
|
||||
}
|
||||
if (!validate_read(strings[i].characters, strings[i].length))
|
||||
auto string = validate_and_copy_string_from_user(strings[i]);
|
||||
if (string.is_null())
|
||||
return false;
|
||||
output.append(copy_string_from_user(strings[i].characters, strings[i].length));
|
||||
output.append(move(string));
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
@ -1801,10 +1798,10 @@ bool Process::validate(const Syscall::ImmutableBufferArgument<DataType, SizeType
|
|||
|
||||
String Process::validate_and_copy_string_from_user(const char* user_characters, size_t user_length) const
|
||||
{
|
||||
if (!user_characters)
|
||||
return {};
|
||||
if (user_length == 0)
|
||||
return String::empty();
|
||||
if (!user_characters)
|
||||
return {};
|
||||
if (!validate_read(user_characters, user_length))
|
||||
return {};
|
||||
SmapDisabler disabler;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue