Skip to content

Commit

Permalink
Fix stack overflow in heapless octetsbuilder with_capacity
Browse files Browse the repository at this point in the history
  • Loading branch information
tertsdiepraam committed Jul 9, 2024
1 parent 3f7797f commit f7bf6cb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ impl<const N: usize> EmptyBuilder for heapless::Vec<u8, N> {

fn with_capacity(capacity: usize) -> Self {
debug_assert!(capacity <= N);
Self::with_capacity(capacity)
// Ignore the capacity because that's determined by the type
heapless::Vec::new()
}
}

Expand Down

0 comments on commit f7bf6cb

Please sign in to comment.