From: Eric Blake Date: Thu, 1 May 2014 02:17:42 +0000 (-0600) Subject: storage: reject negative indices X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=5c05e2b126decbdef1458529443332bc5950d7c4;p=libvirt.git storage: reject negative indices Commit f22b7899 stumbled across a difference between 32-bit and 64-bit platforms when parsing "-1" as an int. Now that we've fixed that difference, it's time to fix the testsuite. * src/util/virstoragefile.c (virStorageFileParseChainIndex): Require a positive index. Signed-off-by: Eric Blake --- diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 5c43665731..6870ae7c40 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -1525,7 +1525,7 @@ virStorageFileParseChainIndex(const char *diskTarget, if (virStringListLength(strings) != 2) goto cleanup; - if (virStrToLong_ui(strings[1], &suffix, 10, &idx) < 0 || + if (virStrToLong_uip(strings[1], &suffix, 10, &idx) < 0 || STRNEQ(suffix, "]")) goto cleanup;