[PATCH] Forbid new-line char in name of networks

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

 



New line character in name of network is now forbidden because it
mess virsh output and can be confusing for users.

Closes-Bug: https://bugzilla.redhat.com/show_bug.cgi?id=818064
---
 src/conf/network_conf.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index aa39776..f9c537f 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -2123,6 +2123,13 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
         goto error;
     }
 
+    if (strchr(def->name, '\n')) {
+        virReportError(
+            VIR_ERR_XML_ERROR,
+            _("name %s cannot contain new-line character"), def->name);
+        goto error;
+    }
+
     /* Extract network uuid */
     tmp = virXPathString("string(./uuid[1])", ctxt);
     if (!tmp) {
-- 
2.10.0

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