[libvirt] [PATCH 2/2] virsh: fix snapshot-create-as to handle arbitrary names

Daniel Veillard veillard at redhat.com
Thu Aug 11 02:33:40 UTC 2011


On Wed, Aug 10, 2011 at 05:02:37PM -0600, Eric Blake wrote:
> Found this while revising the previous patch to use xpath rather
> than strstr for undoing the escapse.

  typo, "escape"

> * tools/virsh.c (cmdSnapshotCreateAs): Escape user input.
> ---
>  tools/virsh.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/virsh.c b/tools/virsh.c
> index fd64020..52a15bc 100644
> --- a/tools/virsh.c
> +++ b/tools/virsh.c
> @@ -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);

  Ah, right ! ACK

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list