From: Andrea Bolognani Date: Tue, 22 Oct 2019 16:34:03 +0000 (+0200) Subject: tests: testQemuCapsIterate: Validate suffix X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=29795544fdf145df9e129dbd578f0862de540e8a;p=libvirt.git tests: testQemuCapsIterate: Validate suffix 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 Reviewed-by: Jiri Denemark --- 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;