]> xenbits.xensource.com Git - libvirt.git/commitdiff
interface: udev backend coverity NULL deref
authorDoug Goldstein <cardoe@cardoe.com>
Tue, 26 Feb 2013 06:27:19 +0000 (00:27 -0600)
committerDoug Goldstein <cardoe@cardoe.com>
Tue, 26 Feb 2013 19:30:17 +0000 (13:30 -0600)
This fixes a potential NULL deref identified by John Ferlan
<jferlan@redhat.com> if scandir() didn't return an expected value.

src/interface/interface_backend_udev.c

index dca85b3f54a623f94ad396d408b7d7e17acdeb04..1132d9aa09a9ec37c3ae10ddbbbe81a1a41a9c8a 100644 (file)
@@ -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] =