crypt: remove checkValidString
Remove the usage of checkValidString in decryptSegment to allow all paths which can be created by encryptSegment to be decryptable.
This commit is contained in:
parent
4b9fdb8475
commit
6c0a749a42
2 changed files with 0 additions and 84 deletions
|
@ -208,21 +208,6 @@ func (c *cipher) putBlock(buf []byte) {
|
|||
c.buffers.Put(buf)
|
||||
}
|
||||
|
||||
// check to see if the byte string is valid with no control characters
|
||||
// from 0x00 to 0x1F and is a valid UTF-8 string
|
||||
func checkValidString(buf []byte) error {
|
||||
for i := range buf {
|
||||
c := buf[i]
|
||||
if c >= 0x00 && c < 0x20 || c == 0x7F {
|
||||
return ErrorBadDecryptControlChar
|
||||
}
|
||||
}
|
||||
if !utf8.Valid(buf) {
|
||||
return ErrorBadDecryptUTF8
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// encodeFileName encodes a filename using a modified version of
|
||||
// standard base32 as described in RFC4648
|
||||
//
|
||||
|
@ -294,10 +279,6 @@ func (c *cipher) decryptSegment(ciphertext string) (string, error) {
|
|||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
err = checkValidString(plaintext)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(plaintext), err
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue