Commit 11a5f91b authored by Peter Hutterer's avatar Peter Hutterer
Browse files

quirks: don't allow single quotes for values



At least not opening single quotes, same as the double quotes we already have.
Add the tests for both.
Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent 41d4ab3d
Pipeline #3151 failed with stages
in 110 minutes and 30 seconds
......@@ -762,7 +762,7 @@ parse_value_line(struct quirks_context *ctx, struct section *s, const char *line
goto out;
/* Whatever the value is, it's not supposed to be in quotes */
if (value[0] == '"')
if (value[0] == '"' || value[0] == '\'')
goto out;
if (strneq(key, "Match", 5))
......
......@@ -420,6 +420,46 @@ START_TEST(quirks_parse_comment_empty)
}
END_TEST
START_TEST(quirks_parse_string_quotes_single)
{
struct quirks_context *ctx;
const char quirks_file[] =
"[Section name]\n"
"MatchUdevType=mouse\n"
"AttrKeyboardIntegration='internal'\n";
struct data_dir dd = make_data_dir(quirks_file);
ctx = quirks_init_subsystem(dd.dirname,
NULL,
log_handler,
NULL,
QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert(ctx == NULL);
quirks_context_unref(ctx);
cleanup_data_dir(dd);
}
END_TEST
START_TEST(quirks_parse_string_quotes_double)
{
struct quirks_context *ctx;
const char quirks_file[] =
"[Section name]\n"
"MatchUdevType=mouse\n"
"AttrKeyboardIntegration=\"internal\"\n";
struct data_dir dd = make_data_dir(quirks_file);
ctx = quirks_init_subsystem(dd.dirname,
NULL,
log_handler,
NULL,
QLOG_CUSTOM_LOG_PRIORITIES);
ck_assert(ctx == NULL);
quirks_context_unref(ctx);
cleanup_data_dir(dd);
}
END_TEST
START_TEST(quirks_parse_bustype)
{
struct quirks_context *ctx;
......@@ -1369,6 +1409,8 @@ TEST_COLLECTION(quirks)
litest_add_deviceless("quirks:parsing", quirks_parse_error_model_not_one);
litest_add_deviceless("quirks:parsing", quirks_parse_comment_inline);
litest_add_deviceless("quirks:parsing", quirks_parse_comment_empty);
litest_add_deviceless("quirks:parsing", quirks_parse_string_quotes_single);
litest_add_deviceless("quirks:parsing", quirks_parse_string_quotes_double);
litest_add_deviceless("quirks:parsing", quirks_parse_bustype);
litest_add_deviceless("quirks:parsing", quirks_parse_bustype_invalid);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment