[PATCH] interface: udev backend coverity NULL deref

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This fixes a potential NULL deref identified by John Ferlan
<jferlan@xxxxxxxxxx> if scandir() didn't return an expected value.
---
 src/interface/interface_backend_udev.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c
index dca85b3..1034429 100644
--- a/src/interface/interface_backend_udev.c
+++ b/src/interface/interface_backend_udev.c
@@ -779,6 +779,13 @@ udevIfaceGetIfaceDefBond(struct udev *udev,
          * so we use the part after the _
          */
         tmp_str = strchr(slave_list[i]->d_name, '_');
+        if (!tmp_str || strlen(tmp_str) < 2) {
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           _("Invalid enslaved interface name '%s' seen for "
+                             "bond '%s'", slave_list[i]->d_name, name));
+            goto cleanup;
+        }
+        /* go past the _ */
         tmp_str++;
 
         ifacedef->data.bond.itf[i] =
-- 
1.7.12.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]