Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6fed32e

Browse files
Merge pull request #1579 from ptf2/enlarge-default-name-buffer
uefi runtime: Increase default size of name buffer
2 parents 77efbc9 + b43d34c commit 6fed32e

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

‎uefi/CHANGELOG.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
zero. The allocation is retried instead, and in all failure cases an error is
2323
returned rather than panicking.
2424
- The `Display` impl for `CStr8` now excludes the trailing null character.
25+
- `VariableKeys` initializes with a larger name buffer to work around firmware
26+
bugs on some devices.
2527

2628

2729
# uefi - 0.34.1 (2025年02月07日)

‎uefi/src/runtime.rs‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@ use uefi_raw::table::boot::MemoryDescriptor;
1616

1717
#[cfg(feature = "alloc")]
1818
use {
19-
crate::mem::make_boxed, crate::CString16, crate::Guid, alloc::borrow::ToOwned,
20-
alloc::boxed::Box, alloc::vec::Vec,
19+
crate::mem::make_boxed,
20+
crate::CString16,
21+
crate::Guid,
22+
alloc::borrow::ToOwned,
23+
alloc::boxed::Box,
24+
alloc::{vec, vec::Vec},
2125
};
2226

2327
#[cfg(all(feature = "unstable", feature = "alloc"))]
@@ -268,13 +272,14 @@ pub struct VariableKeys {
268272
#[cfg(feature = "alloc")]
269273
impl VariableKeys {
270274
fn new() -> Self {
271-
// Create a the name buffer with a reasonable default capacity, and
272-
// initialize it to an empty null-terminated string.
273-
let mut name = Vec::with_capacity(32);
274-
name.push(0);
275+
// Create a name buffer with a large default size and zero
276+
// initialize it. A Toshiba Satellite Pro R50-B-12P was found
277+
// to not correctly update the VariableNameSize passed into
278+
// GetNextVariableName and starting with a large buffer works
279+
// around this issue.
280+
let name = vec![0; 512];
275281

276282
Self {
277-
// Give the name buffer a reasonable default capacity.
278283
name,
279284
// The initial vendor GUID is arbitrary.
280285
vendor: VariableVendor(Guid::default()),

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /