public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH installer] fix #8020: common: dmi: don't error out on invalid strings
@ 2026-09-10 10:15 Christoph Heiss
  0 siblings, 0 replies; only message in thread
From: Christoph Heiss @ 2026-09-10 10:15 UTC (permalink / raw)
  To: pve-devel

.. when reading attributes.

Fixes #8020 [0].

Although the SMBIOS specification states that text strings must be
encoded as UTF-8 (w/o BOM) [1], bogus/broken firmwares may put junk
bytes in there.

On consumer hardware, there is normally also no way to change/fix these
entries.

So just skip these invalid attributes, which don't contain valid UTF-8.

[0] https://bugzilla.proxmox.com/show_bug.cgi?id=8020
[1] DSP0134 SMBIOS spec v3.9.0; section 6.1.3 "Text strings"

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
 proxmox-installer-common/src/dmi.rs | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/proxmox-installer-common/src/dmi.rs b/proxmox-installer-common/src/dmi.rs
index 76ae4a5..a1127e3 100644
--- a/proxmox-installer-common/src/dmi.rs
+++ b/proxmox-installer-common/src/dmi.rs
@@ -1,4 +1,4 @@
-use std::{collections::HashMap, fs};
+use std::{collections::HashMap, fs, io::ErrorKind};
 
 use anyhow::{Result, bail};
 use proxmox_installer_types::SystemDMI;
@@ -28,8 +28,10 @@ fn get_dmi_infos_for(files: &[&str]) -> Result<HashMap<String, String>> {
     for file in files {
         let path = format!("{DMI_PATH}/{file}");
         let content = match fs::read_to_string(&path) {
-            Err(ref err) if err.kind() == std::io::ErrorKind::NotFound => continue,
-            Err(ref err) if err.kind() == std::io::ErrorKind::PermissionDenied => {
+            Err(ref err) if [ErrorKind::NotFound, ErrorKind::InvalidData].contains(&err.kind()) => {
+                continue;
+            }
+            Err(ref err) if err.kind() == ErrorKind::PermissionDenied => {
                 bail!("Could not read data. Are you running as root or with sudo?")
             }
             Err(err) => bail!("Error: '{err}' on '{path}'"),
-- 
2.55.0





^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-10 10:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-10 10:15 [PATCH installer] fix #8020: common: dmi: don't error out on invalid strings Christoph Heiss

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal