summaryrefslogtreecommitdiff
path: root/internal/fusefrontend/openbackingdir.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2019-02-17 17:05:05 +0100
committerJakob Unterwurzacher2019-02-17 17:05:05 +0100
commit19cb6d046aac92f44722c17ba9a371b08ca0be6a (patch)
treec7134052a935c75ab834786a59df9529aa8495f3 /internal/fusefrontend/openbackingdir.go
parent26286a5f8cbd11557bc6e733741fbd3980f6d050 (diff)
nametransform: reject names longer than 255 chars
Looks like we allowed creating longer names by accident. Fix that, and add a test that verifies it.
Diffstat (limited to 'internal/fusefrontend/openbackingdir.go')
-rw-r--r--internal/fusefrontend/openbackingdir.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/internal/fusefrontend/openbackingdir.go b/internal/fusefrontend/openbackingdir.go
index 1cca81b..e9e10db 100644
--- a/internal/fusefrontend/openbackingdir.go
+++ b/internal/fusefrontend/openbackingdir.go
@@ -38,7 +38,11 @@ func (fs *FS) openBackingDir(relPath string) (dirfd int, cName string, err error
return dirfd, ".", nil
}
name := filepath.Base(relPath)
- cName = fs.nameTransform.EncryptAndHashName(name, iv)
+ cName, err = fs.nameTransform.EncryptAndHashName(name, iv)
+ if err != nil {
+ syscall.Close(dirfd)
+ return -1, "", err
+ }
return dirfd, cName, nil
}
// Open cipherdir (following symlinks)
@@ -58,7 +62,11 @@ func (fs *FS) openBackingDir(relPath string) (dirfd int, cName string, err error
syscall.Close(dirfd)
return -1, "", err
}
- cName = fs.nameTransform.EncryptAndHashName(name, iv)
+ cName, err = fs.nameTransform.EncryptAndHashName(name, iv)
+ if err != nil {
+ syscall.Close(dirfd)
+ return -1, "", err
+ }
// Last part? We are done.
if i == len(parts)-1 {
fs.dirCache.Store(dirRelPath, dirfd, iv)