[Libvir] diagnose invalid domain ID numbers (and invalid integers, in general)
Daniel P. Berrange
berrange at redhat.com
Sat Nov 17 13:17:34 UTC 2007
On Fri, Nov 09, 2007 at 10:30:15PM +0100, Jim Meyering wrote:
> Jim Meyering <jim at meyering.net> wrote:
> > There are over 30 uses of strtol in libvirt, and they all can silently
> > accept invalid input. The invalid string might range from an outlandish
> > domain ID like 4294967298 to strings of digits followed by bogus alpha.
> > Maybe not worth worrying about, you say? But what if they indicate user
> > confusion, e.g., 1,000 vs 1000? Silently interpreting "1,000" as "1"
> > would leave the poor user even more confused :-) IMHO, they should all
> > be diagnosed.
> * tests/Makefile.am: Add int-overflow to TESTS.
> Define TESTS_ENVIRONMENT, to propagate $abs_top_* variables
> into the int-overflow script.
> Adapt the "valgrind" rule not to clobber new TESTS_ENVIRONMENT.
>
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -38,13 +38,19 @@ noinst_PROGRAMS = xmlrpctest xml2sexprtest sexpr2xmltest virshtest conftest \
> nodeinfotest
>
> TESTS = xml2sexprtest sexpr2xmltest virshtest test_conf.sh xmconfigtest \
> - xencapstest qemuxml2argvtest qemuxml2xmltest nodeinfotest
> + xencapstest qemuxml2argvtest qemuxml2xmltest nodeinfotest \
> + int-overflow
> if ENABLE_XEN_TESTS
> TESTS += reconnect
> endif
>
> +TESTS_ENVIRONMENT = \
> + abs_top_builddir='$(abs_top_builddir)' \
> + abs_top_srcdir='$(abs_top_srcdir)' \
> + $(VG)
> +
I've had to make a change to this rule. automake-1.9 which is in Fedora 6,
RHEL-5 and Debian does not provide any abs_* variable definitions at all.
These were new in automake-1.10
The change I applied was this:
--- tests/Makefile.am 15 Nov 2007 13:04:28 -0000 1.26
+++ tests/Makefile.am 17 Nov 2007 13:05:08 -0000
@@ -53,8 +53,8 @@ if ENABLE_XEN_TESTS
endif
TESTS_ENVIRONMENT = \
- abs_top_builddir='$(abs_top_builddir)' \
- abs_top_srcdir='$(abs_top_srcdir)' \
+ abs_top_builddir=`pwd`/$(top_builddir) \
+ abs_top_srcdir=`pwd`/$(top_srcdir) \
$(VG)
valgrind:
I checked regular & VPATH builds on FC6, RHEL-5 and F8 and they all now
work again with this fix
Regards,
Dan.
--
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=|
|=- Perl modules: http://search.cpan.org/~danberr/ -=|
|=- Projects: http://freshmeat.net/~danielpb/ -=|
|=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
More information about the libvir-list
mailing list