vfs: add FILE_NAME_MAX_LEN
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
parent
841c00fad1
commit
f9a94f76dc
2 changed files with 6 additions and 4 deletions
|
|
@ -45,11 +45,11 @@ static int next_level(const char *path, dirent_t *dent, dirent_t **out_dirent)
|
|||
return -EINVAL;
|
||||
|
||||
int res;
|
||||
char *build = kzalloc(256, ALLOC_KERN);
|
||||
char *build = kzalloc(FILE_NAME_MAX_LEN + 1, ALLOC_KERN);
|
||||
if (!build)
|
||||
return -ENOMEM;
|
||||
|
||||
for (int i = 0; i < 255; i++) {
|
||||
for (int i = 0; i < FILE_NAME_MAX_LEN; i++) {
|
||||
char c = path[i];
|
||||
|
||||
if (c == '/' || c == '\0') {
|
||||
|
|
@ -174,7 +174,7 @@ int vfs_creat(dirent_t *parent, const char *name, u64 mode, int flags, dirent_t
|
|||
|
||||
inode_t *ino = parent->inode;
|
||||
size_t len = strlen(name);
|
||||
if (len > 255)
|
||||
if (len > FILE_NAME_MAX_LEN)
|
||||
return -ENAMETOOLONG;
|
||||
|
||||
if ((ino->mode & S_IFMT) != S_IFDIR)
|
||||
|
|
|
|||
Loading…
Reference in a new issue