Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions library/std/src/sys/paths/uefi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ where
}

let v = path.as_ref().encode_wide().collect::<Vec<u16>>();
if v.contains(&PATHS_SEP) {
// Interior NULs would truncate when the joined string is later treated
// as a C-style wide string (e.g. the UEFI Shell Path variable).
if v.contains(&0) {
return Err(JoinPathsError);
} else if v.contains(&PATHS_SEP) {
return Err(JoinPathsError);
}

Expand All @@ -101,7 +105,7 @@ where

impl fmt::Display for JoinPathsError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
"path segment contains `;`".fmt(f)
"path segment contains `;` or interior NUL".fmt(f)
}
}

Expand Down