Skip to content

Commit 3a758ee

Browse files
committed
Byte array: visit_seq: Take only N items
1 parent 985cd97 commit 3a758ee

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/bytearray.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,11 @@ impl<'de, const N: usize> Visitor<'de> for ByteArrayVisitor<N> {
188188
let mut bytes = [0; N];
189189
let mut idx = 0;
190190
while let Some(b) = visitor.next_element()? {
191-
if idx >= N {
192-
return Err(V::Error::invalid_length(N, &self));
193-
}
194-
195191
bytes[idx] = b;
196192
idx += 1;
193+
if idx == N {
194+
break;
195+
}
197196
}
198197

199198
if idx != N {

0 commit comments

Comments
 (0)