File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,6 @@ impl KeyObfuscator {
8181 let ( wrapped_nonce_bytes, wrapped_nonce_tag_bytes) = remaining. split_at ( NONCE_LENGTH ) ;
8282 let mut wrapped_nonce_tag = [ 0u8 ; TAG_LENGTH ] ;
8383 wrapped_nonce_tag. copy_from_slice ( wrapped_nonce_tag_bytes) ;
84- debug_assert_eq ! ( wrapped_nonce_tag. len( ) , TAG_LENGTH ) ;
8584
8685 // Unwrap wrapped_nonce to get nonce.
8786 let mut wrapped_nonce = [ 0u8 ; NONCE_LENGTH ] ;
Original file line number Diff line number Diff line change @@ -72,6 +72,10 @@ impl<T: EntropySource> StorableBuilder<T> {
7272 let encryption_metadata = storable
7373 . encryption_metadata
7474 . ok_or_else ( || Error :: new ( ErrorKind :: InvalidData , "Invalid Metadata" ) ) ?;
75+
76+ if encryption_metadata. nonce . len ( ) != 12 {
77+ return Err ( Error :: new ( ErrorKind :: InvalidData , "Invalid Metadata" ) ) ;
78+ }
7579 let mut nonce = [ 0u8 ; 12 ] ;
7680 nonce. copy_from_slice ( & encryption_metadata. nonce ) ;
7781
You can’t perform that action at this time.
0 commit comments