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

Sławek Kapłoński slawek at kaplonski.pl
Sat Oct 8 21:38:48 UTC 2016


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




More information about the libvir-list mailing list