mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-04 15:30:14 +01:00
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 <peter.hutterer@who-t.net>
This commit is contained in:
parent
41d4ab3d62
commit
11a5f91bb7
2 changed files with 43 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue