summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fsimpl/kernfs
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-04-03 02:41:20 +0000
committergVisor bot <gvisor-bot@google.com>2020-04-03 02:41:20 +0000
commit2aa08b300235a3b09c3736b4efd6ddd87d8941c5 (patch)
treeb2c96540660d560906ed63ee55b3133bfd9444d3 /pkg/sentry/fsimpl/kernfs
parentb47ca9ab2fe0594ba11bcaa42af0a333832c7136 (diff)
parentdd3bc499970c22ebbd270030b4564e6b8e4e929e (diff)
Merge release-20200323.0-62-gdd3bc49 (automated)
Diffstat (limited to 'pkg/sentry/fsimpl/kernfs')
-rwxr-xr-xpkg/sentry/fsimpl/kernfs/filesystem.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/pkg/sentry/fsimpl/kernfs/filesystem.go b/pkg/sentry/fsimpl/kernfs/filesystem.go
index a429fa23d..89f5da3d4 100755
--- a/pkg/sentry/fsimpl/kernfs/filesystem.go
+++ b/pkg/sentry/fsimpl/kernfs/filesystem.go
@@ -63,6 +63,9 @@ afterSymlink:
rp.Advance()
return nextVFSD, nil
}
+ if len(name) > linux.NAME_MAX {
+ return nil, syserror.ENAMETOOLONG
+ }
d.dirMu.Lock()
nextVFSD, err := rp.ResolveChild(vfsd, name)
if err != nil {
@@ -191,6 +194,9 @@ func checkCreateLocked(ctx context.Context, rp *vfs.ResolvingPath, parentVFSD *v
if pc == "." || pc == ".." {
return "", syserror.EEXIST
}
+ if len(pc) > linux.NAME_MAX {
+ return "", syserror.ENAMETOOLONG
+ }
childVFSD, err := rp.ResolveChild(parentVFSD, pc)
if err != nil {
return "", err
@@ -433,6 +439,9 @@ afterTrailingSymlink:
if pc == "." || pc == ".." {
return nil, syserror.EISDIR
}
+ if len(pc) > linux.NAME_MAX {
+ return nil, syserror.ENAMETOOLONG
+ }
// Determine whether or not we need to create a file.
childVFSD, err := rp.ResolveChild(parentVFSD, pc)
if err != nil {