From 1e7bcd894375319244dfbbc56a744bc1a00209c0 Mon Sep 17 00:00:00 2001 From: George Kiagiadakis <george.kiagiadakis@collabora.com> Date: Thu, 27 Jun 2019 18:30:11 +0300 Subject: [PATCH] config: ensure that both ABI and MODULE are specified before the properties If we have properties, strtok will return strings from there as tokens and the error will appear later as we will attempt to parse an incomplete GVariant. It is better to catch this early so that we can print a more useful error message. --- src/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index c375324d..0af70cd7 100644 --- a/src/main.c +++ b/src/main.c @@ -152,7 +152,9 @@ parse_commands_file (struct WpDaemonData *d, GInputStream * stream, abi = strtok_r (NULL, " ", &saveptr); module = strtok_r (NULL, " ", &saveptr); - if (!abi || !module) { + if (!abi || !module || + (abi && abi[0] == '{') || (module && module[0] == '{')) + { g_set_error (error, WP_DOMAIN_DAEMON, WP_CODE_INVALID_ARGUMENT, "expected ABI and MODULE at line %i", lineno); return FALSE; -- GitLab