File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -739,11 +739,21 @@ func validateOwnerPassword(ctx *model.Context) (ok bool, err error) {
739739
740740func validateCFLength (len int , cfm * string ) bool {
741741 // See table 25 Length
742+ // Note: Length can be expressed in bytes or bits depending on the security handler.
743+ // AESV2 (AES-128) expects Length=16 (bytes) or Length=128 (bits)
744+ // AESV3 (AES-256) expects Length=32 (bytes) or Length=256 (bits)
742745
743746 if cfm != nil {
744- if ( * cfm == "AESV2" && len != 16 ) || ( * cfm == "AESV3" && len != 32 ) {
747+ if * cfm == "AESV2" && len != 16 && len != 128 {
745748 return false
746749 }
750+ if * cfm == "AESV3" && len != 32 && len != 256 {
751+ return false
752+ }
753+ // If we matched a valid AESV2 or AESV3 length, return early
754+ if * cfm == "AESV2" || * cfm == "AESV3" {
755+ return true
756+ }
747757 }
748758
749759 // Standard security handler expresses in bytes.
You can’t perform that action at this time.
0 commit comments