mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Enforce name length restriction on paths.
NAME_LENGTH must be enforced per component. PiperOrigin-RevId: 224046749 Change-Id: Iba8105b00d951f2509dc768af58e4110dafbe1c9
This commit is contained in:
@@ -458,6 +458,12 @@ func (d *Dirent) walk(ctx context.Context, root *Dirent, name string, walkMayUnl
|
||||
if !IsDir(d.Inode.StableAttr) {
|
||||
return nil, syscall.ENOTDIR
|
||||
}
|
||||
|
||||
// The component must be less than NAME_MAX.
|
||||
if len(name) > linux.NAME_MAX {
|
||||
return nil, syscall.ENAMETOOLONG
|
||||
}
|
||||
|
||||
if name == "" || name == "." {
|
||||
d.IncRef()
|
||||
return d, nil
|
||||
|
||||
Reference in New Issue
Block a user