]> xenbits.xensource.com Git - libvirt.git/commitdiff
storage: reject negative indices
authorEric Blake <eblake@redhat.com>
Thu, 1 May 2014 02:17:42 +0000 (20:17 -0600)
committerEric Blake <eblake@redhat.com>
Thu, 1 May 2014 21:11:02 +0000 (15:11 -0600)
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 <eblake@redhat.com>
src/util/virstoragefile.c

index 5c43665731a864ba5757704599bde2424885d038..6870ae7c4036ad683e75ff37bb0ee1c8c2cd72d2 100644 (file)
@@ -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;