diff --git a/cmd/backend/users.go b/cmd/backend/users.go index 47d76e4..c01a1cf 100644 --- a/cmd/backend/users.go +++ b/cmd/backend/users.go @@ -117,6 +117,9 @@ func aesDecrypt(c *Config, ciphertext string) (string, error) { } nonceSize := gcm.NonceSize() + if len(data) < nonceSize { + return "", errors.New("ciphertext too short") + } nonce, cipherText := data[:nonceSize], data[nonceSize:] plaintext, err := gcm.Open(nil, nonce, cipherText, nil)