public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Christoph Heiss <c.heiss@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH installer] fix #8020: common: dmi: don't error out on invalid strings
Date: Thu, 10 Sep 2026 12:15:34 +0200	[thread overview]
Message-ID: <20260910101543.537312-1-c.heiss@proxmox.com> (raw)

.. 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





                 reply	other threads:[~2026-09-10 10:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260910101543.537312-1-c.heiss@proxmox.com \
    --to=c.heiss@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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