Skip to content

Commit 1137612

Browse files
authored
fix
1 parent 708b94f commit 1137612

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

block-padding/src/lib.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,13 @@ impl Padding for ZeroPadding {
103103
fn unpad_blocks<BlockSize: ArraySize>(
104104
blocks: &[Array<u8, BlockSize>],
105105
) -> Result<&[u8], UnpadError> {
106-
for i in (0..block.len()).rev() {
107-
if block[i] != 0 {
108-
return Ok(&block[..i + 1]);
106+
let buf = Array::slice_as_flattened(blocks);
107+
for i in (0..buf.len()).rev() {
108+
if buf[i] != 0 {
109+
return Ok(&buf[..i + 1]);
109110
}
110111
}
111-
Ok(&block[..0])
112+
Ok(&buf[..0])
112113
}
113114
}
114115

0 commit comments

Comments
 (0)