]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: testQemuCapsIterate: Validate suffix
authorAndrea Bolognani <abologna@redhat.com>
Tue, 22 Oct 2019 16:34:03 +0000 (18:34 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Thu, 24 Oct 2019 15:21:08 +0000 (17:21 +0200)
We're going to depend on the fact that the suffix starts with a
dot later on, so we better ensure that it does.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
tests/testutilsqemu.c

index 7a2ea3bf4ec6301c5427956b0fbda1ed7c309650..c60225514940df35d4fa10cc8585e3309ff982fe 100644 (file)
@@ -906,6 +906,12 @@ testQemuCapsIterate(const char *suffix,
     if (!callback)
         return 0;
 
+    /* Validate suffix */
+    if (!STRPREFIX(suffix, ".")) {
+        VIR_TEST_VERBOSE("malformed suffix '%s'", suffix);
+        goto cleanup;
+    }
+
     if (virDirOpen(&dir, TEST_QEMU_CAPS_PATH) < 0)
         goto cleanup;