[libvirt] [PATCH] cpu_conf: properly escape characters for model and vendor

Pavel Hrdina phrdina at redhat.com
Tue May 5 15:04:02 UTC 2015


We should escape strings for those two elements to be consistent along
the whole XML.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1197580

Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 src/conf/cpu_conf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index e959ecc..34725c0 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -547,14 +547,14 @@ virCPUDefFormatBuf(virBufferPtr buf,
                 virBufferAsprintf(buf, " vendor_id='%s'", def->vendor_id);
         }
         if (formatModel && def->model) {
-            virBufferAsprintf(buf, ">%s</model>\n", def->model);
+            virBufferEscapeString(buf, ">%s</model>\n", def->model);
         } else {
             virBufferAddLit(buf, "/>\n");
         }
     }
 
     if (formatModel && def->vendor)
-        virBufferAsprintf(buf, "<vendor>%s</vendor>\n", def->vendor);
+        virBufferEscapeString(buf, "<vendor>%s</vendor>\n", def->vendor);
 
     if (def->sockets && def->cores && def->threads) {
         virBufferAddLit(buf, "<topology");
-- 
2.3.6




More information about the libvir-list mailing list