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.
This commit is contained in:
@@ -152,7 +152,9 @@ parse_commands_file (struct WpDaemonData *d, GInputStream * stream,
|
|||||||
abi = strtok_r (NULL, " ", &saveptr);
|
abi = strtok_r (NULL, " ", &saveptr);
|
||||||
module = 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,
|
g_set_error (error, WP_DOMAIN_DAEMON, WP_CODE_INVALID_ARGUMENT,
|
||||||
"expected ABI and MODULE at line %i", lineno);
|
"expected ABI and MODULE at line %i", lineno);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
Reference in New Issue
Block a user