interface: udev backend coverity NULL deref

This fixes a potential NULL deref identified by John Ferlan
<jferlan@redhat.com> if scandir() didn't return an expected value.
This commit is contained in:
Doug Goldstein 2013-02-26 00:27:19 -06:00
parent 464c92c051
commit 01207bb703

View 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] =