<div dir="ltr">Signed-off-by: Simon Kobyda <<a href="mailto:skobyda@redhat.com">skobyda@redhat.com</a>></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Jul 12, 2018 at 3:10 PM Simon Kobyda <<a href="mailto:skobyda@redhat.com">skobyda@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">XML shmem name will not include character '/', and will not be equal to strings<br>
"." or "..", as shmem name is used in a path.<br>
<br>
<a href="https://bugzilla.redhat.com/show_bug.cgi?id=1192400" rel="noreferrer" target="_blank">https://bugzilla.redhat.com/show_bug.cgi?id=1192400</a><br>
---<br>
<br>
Changes in V2 <br>
        - Added error reports<br>
        - Error situation will happen only if shmem name is equal to<br>
          "." or "..", however their occurence in a name compromised of more<br>
          characters is allowed.<br>
<br>
 src/conf/domain_conf.c | 22 ++++++++++++++++++++++<br>
 1 file changed, 22 insertions(+)<br>
<br>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c<br>
index 7ab2953d83..6b34c17de4 100644<br>
--- a/src/conf/domain_conf.c<br>
+++ b/src/conf/domain_conf.c<br>
@@ -6107,6 +6107,8 @@ virDomainDefLifecycleActionValidate(const virDomainDef *def)<br>
 static int<br>
 virDomainDefValidateInternal(const virDomainDef *def)<br>
 {<br>
+    size_t i;<br>
+<br>
     if (virDomainDefCheckDuplicateDiskInfo(def) < 0)<br>
         return -1;<br>
<br>
@@ -6136,6 +6138,26 @@ virDomainDefValidateInternal(const virDomainDef *def)<br>
         return -1;<br>
     }<br>
<br>
+    for (i = 0; i < def->nshmems; i++) {<br>
+        if (strchr(def->shmems[i]->name, '/')) {<br>
+            virReportError(VIR_ERR_XML_ERROR, "%s",<br>
+                           _("shmem name cannot include '/' character"));<br>
+            return -1;<br>
+        }<br>
+<br>
+        if (STREQ(def->shmems[i]->name, ".")) {<br>
+            virReportError(VIR_ERR_XML_ERROR, "%s",<br>
+                           _("shmem name cannot be equal to '.'"));<br>
+            return -1;<br>
+        }<br>
+<br>
+        if (STREQ(def->shmems[i]->name, "..")) {<br>
+            virReportError(VIR_ERR_XML_ERROR, "%s",<br>
+                           _("shmem name cannot be equal to '..'"));<br>
+            return -1;<br>
+        }<br>
+    }<br>
+<br>
     if (virDomainDefLifecycleActionValidate(def) < 0)<br>
         return -1;<br>
<br>
-- <br>
2.17.1<br>
<br>
</blockquote></div>