summaryrefslogtreecommitdiff
path: root/internal/nametransform/names.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/nametransform/names.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/nametransform/names.go')
-rw-r--r--internal/nametransform/names.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/internal/nametransform/names.go b/internal/nametransform/names.go
index 638a9eb..20fbede 100644
--- a/internal/nametransform/names.go
+++ b/internal/nametransform/names.go
@@ -12,6 +12,11 @@ import (
"github.com/rfjakob/gocryptfs/internal/tlog"
)
+const (
+ // Like ext4, we allow at most 255 bytes for a file name.
+ NameMax = 255
+)
+
// NameTransform is used to transform filenames.
type NameTransform struct {
emeCipher *eme.EMECipher