From 84d4b4fcf0b2809e1857be3c17099ba1c41d7ea7 Mon Sep 17 00:00:00 2001
From: chenjiayi <chenjiayi22@huawei.com>
Date: Thu, 2 Nov 2023 21:44:50 +0800
Subject: [PATCH 023/103] fix(devmaster): fix out-of-bounds in net_id

The pci subclass consists of two numbers, but is captured with three
length by mistake.
---
 exts/devmaster/src/lib/builtin/net_id.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/exts/devmaster/src/lib/builtin/net_id.rs b/exts/devmaster/src/lib/builtin/net_id.rs
index e5f1faa6..091d6ccd 100644
--- a/exts/devmaster/src/lib/builtin/net_id.rs
+++ b/exts/devmaster/src/lib/builtin/net_id.rs
@@ -338,7 +338,7 @@ fn is_pci_bridge(dev: Rc<RefCell<Device>>) -> bool {
 
     /* PCI device subclass 04 corresponds to PCI bridge */
     // modalias[idx+2:2
-    let pci_subclass = match modalias.get(idx + 2..idx + 5) {
+    let pci_subclass = match modalias.get(idx + 2..idx + 4) {
         Some(s) => s,
         None => return false,
     };
-- 
2.33.0

