Skip to content

Commit 98670a3

Browse files
authored
Merge pull request #794 from nicholasbishop/bishop-fix-vec-with
uefi: Clear the Vec in DevicePathBuilder::with_vec
2 parents 0044c73 + 8313bbc commit 98670a3

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
- The `Revision` struct's one field is now public.
5151
- Renamed `CStr8::to_bytes` to `CStr8::as_bytes` and changed the semantics:
5252
The trailing null character is now always included in the returned slice.
53+
- `DevicePathBuilder::with_vec` now clears the `Vec` before use.
5354

5455
## uefi-macros - [Unreleased]
5556

uefi/src/proto/device_path/build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,11 @@ impl<'a> DevicePathBuilder<'a> {
8383
}
8484

8585
/// Create a builder backed by a `Vec`.
86+
///
87+
/// The `Vec` is cleared before use.
8688
#[cfg(feature = "alloc")]
8789
pub fn with_vec(v: &'a mut Vec<u8>) -> Self {
90+
v.clear();
8891
Self {
8992
storage: BuilderStorage::Vec(v),
9093
}

0 commit comments

Comments
 (0)