[libvirt] [PATCH] Strip control codes in virBufferEscapeString

Eric Blake eblake at redhat.com
Mon Mar 30 13:06:45 UTC 2015


On 03/30/2015 05:02 AM, Ján Tomko wrote:
> These cannot be represented in XML.

Yes they can, via entities.  DV would know for sure, but I think that
 is the entity for the C byte '\1'.

> 
> We have been stripping them, but only if the string had
> characters that needed escaping: <>"'&
> 
> Extend the strcspn check to include control codes, and strip
> them even if we don't do any escaping.

NACK.  Stripping control codes from a volume name represents the wrong
name.  We need to escape the problematic bytes, rather than strip them.

> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1184131
> https://bugzilla.redhat.com/show_bug.cgi?id=1066564
> ---
>  src/util/virbuffer.c | 14 +++++++++++---
>  tests/virbuftest.c   | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 60 insertions(+), 3 deletions(-)

As there are real bugs that will be fixed once we use the correct
entities, I'm looking forward to v2.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150330/97e44f1e/attachment-0001.sig>


More information about the libvir-list mailing list