nametransform: Return error if decrypted name is '.' or '..'

This commit is contained in:
Sebastian Lackner 2017-11-22 06:11:19 +01:00 committed by rfjakob
parent f3c777d5ea
commit c547673529
1 changed files with 4 additions and 0 deletions

View File

@ -65,6 +65,10 @@ func (n *NameTransform) DecryptName(cipherName string, iv []byte) (string, error
if bytes.Contains(bin, []byte{0}) || bytes.Contains(bin, []byte("/")) {
return "", syscall.EBADMSG
}
// The name should never be "." or "..".
if bytes.Equal(bin, []byte(".")) || bytes.Equal(bin, []byte("..")) {
return "", syscall.EBADMSG
}
plain := string(bin)
return plain, err
}