[libvirt] [PATCH 03/12] tests: testQemuCapsIterate: Validate suffix

Andrea Bolognani abologna at redhat.com
Wed Oct 23 10:42:53 UTC 2019


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 at redhat.com>
---
 tests/testutilsqemu.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 7a2ea3bf4e..c602255149 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -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;
 
-- 
2.21.0




More information about the libvir-list mailing list