[libvirt] [PATCHv2 3/3] storage: reject negative indices

Eric Blake eblake at redhat.com
Thu May 1 02:28:02 UTC 2014


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 at redhat.com>
---
 src/util/virstoragefile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 5c43665..6870ae7 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;

-- 
1.9.0




More information about the libvir-list mailing list