On Tue, Jan 05, 2010 at 02:51:06PM +0200, Dan Kenigsberg wrote: > Please consider something along these lines. Without it, pretty-printed > domxml is rejected due to the whitespace before uuid, and long long > string of hexadecimal digits is accepted. > --- > src/util/uuid.c | 12 +++++++++++- > 1 files changed, 11 insertions(+), 1 deletions(-) > > diff --git a/src/util/uuid.c b/src/util/uuid.c > index 002a64d..0f2ca96 100644 > --- a/src/util/uuid.c > +++ b/src/util/uuid.c > @@ -145,9 +145,13 @@ virUUIDParse(const char *uuidstr, unsigned char *uuid) { > > /* > * do a liberal scan allowing '-' and ' ' anywhere between character > - * pairs as long as there is 32 of them in the end. > + * pairs, and surrounding whitespace, as long as there are exactly > + * 32 hexadecimal digits the end. > */ > cur = uuidstr; > + while (c_isspace(*cur)) > + cur++; > + > for (i = 0;i < VIR_UUID_BUFLEN;) { > uuid[i] = 0; > if (*cur == 0) > @@ -170,6 +174,12 @@ virUUIDParse(const char *uuidstr, unsigned char *uuid) { > cur++; > } > > + while (*cur) { > + if (!c_isspace(*cur)) > + goto error; > + cur++; > + } > + > return 0; > > error: Yes that looks fine to me and testing for NUL termination sound important, ACK, pushed, thanks ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@xxxxxxxxxxxx | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list