We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 6ed52f2 + 3c90fe6 commit 5ad0884Copy full SHA for 5ad0884
src/windows/utils.rs
@@ -136,10 +136,10 @@ cfg_if! {
136
let info: T = unsafe { std::ptr::read_unaligned(table[i..].as_ptr() as *const _) };
137
138
// As said in the SMBIOS 3 standard: https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.6.0.pdf,
139
- // the strings are necessarily in UTF-8.
+ // the strings are necessarily in UTF-8. But sometimes virtual machines may return non-compliant data.
140
let values = table[(i + info.length() as usize)..]
141
.split(|&b| b == 0)
142
- .map(|s| unsafe { std::str::from_utf8_unchecked(s) })
+ .filter_map(|s| std::str::from_utf8(s).ok())
143
.take_while(|s| !s.is_empty())
144
.collect();
145
0 commit comments