From 29795544fdf145df9e129dbd578f0862de540e8a Mon Sep 17 00:00:00 2001 From: Andrea Bolognani Date: Tue, 22 Oct 2019 18:34:03 +0200 Subject: [PATCH] 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 --- 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.47.2