mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 07:07:23 +00:00
Kernel: Don't include null terminator in sys$readlink() result
POSIX says, "Conforming applications should not assume that the returned contents of the symbolic link are null-terminated." If we do include the null terminator into the returning string, Python believes it to actually be a part of the returned name, and gets unhappy about that later. This suggests other systems Python runs in don't include it, so let's do that too. Also, make our userspace support non-null-terminated realpath().
This commit is contained in:
committed by
Andreas Kling
parent
1dee4d0049
commit
f18d6610d3
@@ -1950,10 +1950,10 @@ int Process::sys$readlink(const Syscall::SC_readlink_params* user_params)
|
||||
return -EIO; // FIXME: Get a more detailed error from VFS.
|
||||
|
||||
auto link_target = String::copy(contents);
|
||||
if (link_target.length() + 1 > params.buffer.size)
|
||||
if (link_target.length() > params.buffer.size)
|
||||
return -ENAMETOOLONG;
|
||||
copy_to_user(params.buffer.data, link_target.characters(), link_target.length() + 1);
|
||||
return link_target.length() + 1;
|
||||
copy_to_user(params.buffer.data, link_target.characters(), link_target.length());
|
||||
return link_target.length();
|
||||
}
|
||||
|
||||
int Process::sys$chdir(const char* user_path, size_t path_length)
|
||||
|
||||
Reference in New Issue
Block a user