[PATCH 1/2] netdev: accept NULL in virNetDevSetupControl

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

 



Commit b9c6b073 dropped the version of virNetDevSetupControl
that didn't check for NULL arguments, but we call it like that
in virNetDevBridgeDelete.
---
 src/util/virnetdev.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index 7aba515..ebe20d0 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -62,13 +62,15 @@ static int virNetDevSetupControlFull(const char *ifname,
 {
     int fd;
 
-    memset(ifr, 0, sizeof(*ifr));
+    if (ifr && ifname) {
+        memset(ifr, 0, sizeof(*ifr));
 
-    if (virStrcpyStatic(ifr->ifr_name, ifname) == NULL) {
-        virReportSystemError(ERANGE,
-                             _("Network interface name '%s' is too long"),
-                             ifname);
-        return -1;
+        if (virStrcpyStatic(ifr->ifr_name, ifname) == NULL) {
+            virReportSystemError(ERANGE,
+                                 _("Network interface name '%s' is too long"),
+                                 ifname);
+            return -1;
+        }
     }
 
     if ((fd = socket(domain, type, 0)) < 0) {
-- 
1.8.1.5

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