]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commit
conf: tighten up XML integer parsing
authorEric Blake <eblake@redhat.com>
Wed, 18 Apr 2012 23:58:44 +0000 (17:58 -0600)
committerEric Blake <eblake@redhat.com>
Thu, 19 Apr 2012 23:42:53 +0000 (17:42 -0600)
commitc09acad352039d896f45374a8241910fb207ae56
tree90d63299e2149b9aa2d1cc191f81825f436c1705
parentbb65c8af33d53d3dc140ae003bc4ff3509f1eb7d
conf: tighten up XML integer parsing

https://bugzilla.redhat.com/show_bug.cgi?id=617711 reported that
even with my recent patched to allow <memory unit='G'>1</memory>,
people can still get away with trying <memory>1G</memory> and
silently get <memory unit='KiB'>1</memory> instead.  While
virt-xml-validate catches the error, our C parser did not.

Not to mention that it's always fun to fix bugs while reducing
lines of code.  :)

* src/conf/domain_conf.c (virDomainParseMemory): Check for parse error.
(virDomainDefParseXML): Avoid strtoll.
* src/conf/storage_conf.c (virStorageDefParsePerms): Likewise.
* src/util/xml.c (virXPathLongBase, virXPathULongBase)
(virXPathULongLong, virXPathLongLong): Likewise.
src/conf/domain_conf.c
src/conf/storage_conf.c
src/util/xml.c