mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:48:10 +00:00
Kernel: mkdir() should fail if the pathname is empty.
This commit is contained in:
parent
240b5fe677
commit
33e7df5955
1 changed files with 5 additions and 2 deletions
|
@ -1863,10 +1863,13 @@ int Process::sys$mkdir(const char* pathname, mode_t mode)
|
|||
{
|
||||
if (!validate_read_str(pathname))
|
||||
return -EFAULT;
|
||||
if (strlen(pathname) >= 255)
|
||||
size_t pathname_length = strlen(pathname);
|
||||
if (pathname_length == 0)
|
||||
return -EINVAL;
|
||||
if (pathname_length >= 255)
|
||||
return -ENAMETOOLONG;
|
||||
int error;
|
||||
if (!VFS::the().mkdir(pathname, mode, cwd_inode()->identifier(), error))
|
||||
if (!VFS::the().mkdir(String(pathname, pathname_length), mode, cwd_inode()->identifier(), error))
|
||||
return error;
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue