fix pcie id string overrun
authorDebian NVIDIA Maintainers <pkg-nvidia-devel@lists.alioth.debian.org>
Thu, 8 Feb 2024 10:22:15 +0000 (10:22 +0000)
committerRaspbian forward porter <root@raspbian.org>
Thu, 8 Feb 2024 10:22:15 +0000 (10:22 +0000)
Origin: commit:44cd9bd71fb4ded05be51f0d653b59a043b31088
Applied-Upstream: commit:44cd9bd71fb4ded05be51f0d653b59a043b31088
Bug-Debian: https://bugs.debian.org/979006

Gbp-Pq: Name pcie_id_overrun.patch

src/bbsecondary.c

index 14d5104af0a67bd0eb3f9da74be80efc40a435f9..11520b8157bd81dd44fe38e11ba8dae25b428810 100644 (file)
@@ -139,9 +139,10 @@ bool start_secondary(bool need_secondary) {
     return true;
   //no problems, start X if not started yet
   if (!bb_is_running(bb_status.x_pid)) {
-    char pci_id[12];
+    char pci_id[13];
     static char *x_conf_file;
-    snprintf(pci_id, 12, "PCI:%02d:%02d:%o", pci_bus_id_discrete->bus,
+    // 0-255 bus, 0-31 slot, 0-7 func
+    snprintf(pci_id, 13, "PCI:%03d:%02d:%o", pci_bus_id_discrete->bus,
             pci_bus_id_discrete->slot, pci_bus_id_discrete->func);
     if (!x_conf_file) {
       x_conf_file = xorg_path_w_driver(bb_config.x_conf_file, bb_config.driver);