diff mbox

[2/3] conf: network: reject name containing '/'

Message ID 48b3825464a39dc18881a9058b31922395f9cf6c.1461697488.git.crobinso@redhat.com
State Accepted
Commit 454f739f24a936aedec48c3a3ba659b374ce251a
Headers show

Commit Message

Cole Robinson April 26, 2016, 7:21 p.m. UTC
Trying to define a network name containing an embedded '/'
will immediately fail when trying to write the XML to disk.
This patch explicitly rejects names containing a '/'

Besides the network bridge driver, the only other network
implementation is a very thin one for virtualbox, which seems to
use the network name as a host interface name, which won't
accept '/' anyways, so I think this is fine to do unconitionally.

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

-- 
2.7.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff mbox

Patch

diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index e6915ff..1f680d7 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -2070,6 +2070,12 @@  virNetworkDefParseXML(xmlXPathContextPtr ctxt)
         goto error;
     }
 
+    if (strchr(def->name, '/')) {
+        virReportError(VIR_ERR_XML_ERROR,
+                       _("name %s cannot contain '/'"), def->name);
+        goto error;
+    }
+
     /* Extract network uuid */
     tmp = virXPathString("string(./uuid[1])", ctxt);
     if (!tmp) {