]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: fix snapshot-create-as to handle arbitrary names
authorEric Blake <eblake@redhat.com>
Wed, 10 Aug 2011 23:00:26 +0000 (17:00 -0600)
committerEric Blake <eblake@redhat.com>
Thu, 11 Aug 2011 03:54:20 +0000 (21:54 -0600)
Found this working on the next patch to use xpath to parse
arbitrary names back out.

* tools/virsh.c (cmdSnapshotCreateAs): Escape user input.

tools/virsh.c

index b053ed07b472e0121f89c41c762ca27f41878e47..d901d58e593f5f3ffd469e5e826847a749798028 100644 (file)
@@ -11963,9 +11963,9 @@ cmdSnapshotCreateAs(vshControl *ctl, const vshCmd *cmd)
 
     virBufferAddLit(&buf, "<domainsnapshot>\n");
     if (name)
-        virBufferAsprintf(&buf, "  <name>%s</name>\n", name);
+        virBufferEscapeString(&buf, "  <name>%s</name>\n", name);
     if (desc)
-        virBufferAsprintf(&buf, "  <description>%s</description>\n", desc);
+        virBufferEscapeString(&buf, "  <description>%s</description>\n", desc);
     virBufferAddLit(&buf, "</domainsnapshot>\n");
 
     buffer = virBufferContentAndReset(&buf);