diff --git a/daemon/tests/comm/config_mouse.tc b/daemon/tests/comm/config_mouse.tc index ac94ed1..0f04830 100644 --- a/daemon/tests/comm/config_mouse.tc +++ b/daemon/tests/comm/config_mouse.tc @@ -6,11 +6,11 @@ Verify mouse speed is set to 32 config get mouse speed DATA mouse speed 32 -Set mouse speed to invalid value # TODO: May fail +Set mouse speed to invalid value config set mouse speed off ERR "Error 22 setting 'mouse.speed'='off': Invalid argument" -Verify mouse speed is unchanged # TODO: May fail if previous test failed +Verify mouse speed is unchanged config get mouse speed DATA mouse speed 32 diff --git a/daemon/x52d_config_parser.c b/daemon/x52d_config_parser.c index bb85bdb..1afdf1d 100644 --- a/daemon/x52d_config_parser.c +++ b/daemon/x52d_config_parser.c @@ -71,6 +71,10 @@ static int int_parser(struct x52d_config *cfg, size_t offset, const char *value) if (errno != 0) { return errno; } + if (*endptr != '\0') { + // Invalid characters in string + return EINVAL; + } *config = retval; return 0; diff --git a/po/libx52.pot b/po/libx52.pot index a50f243..356c9a7 100644 --- a/po/libx52.pot +++ b/po/libx52.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: libx52 0.2.3\n" "Report-Msgid-Bugs-To: https://github.com/nirenjan/libx52/issues\n" -"POT-Creation-Date: 2022-07-27 12:45-0700\n" +"POT-Creation-Date: 2022-08-31 20:39-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -733,40 +733,40 @@ msgstr "" msgid "Failed to dump %s.%s to config file %s" msgstr "" -#: daemon/x52d_config_parser.c:168 +#: daemon/x52d_config_parser.c:172 #, c-format msgid "Ignoring unknown key '%s.%s'" msgstr "" -#: daemon/x52d_config_parser.c:209 +#: daemon/x52d_config_parser.c:213 #, c-format msgid "Failed processing configuration file %s - code %d" msgstr "" -#: daemon/x52d_config_parser.c:239 +#: daemon/x52d_config_parser.c:243 msgid "Failed to allocate memory for override structure" msgstr "" -#: daemon/x52d_config_parser.c:248 +#: daemon/x52d_config_parser.c:252 msgid "Failed to allocate memory for override string" msgstr "" -#: daemon/x52d_config_parser.c:259 +#: daemon/x52d_config_parser.c:263 #, c-format msgid "No section found in override string '%s'" msgstr "" -#: daemon/x52d_config_parser.c:273 +#: daemon/x52d_config_parser.c:277 #, c-format msgid "No key found in override string '%s'" msgstr "" -#: daemon/x52d_config_parser.c:284 +#: daemon/x52d_config_parser.c:288 #, c-format msgid "No value found in override string '%s'" msgstr "" -#: daemon/x52d_config_parser.c:335 +#: daemon/x52d_config_parser.c:339 #, c-format msgid "Error processing override '%s.%s=%s'" msgstr "" diff --git a/po/xx_PL.po b/po/xx_PL.po index 36b5fba..cb9d7a9 100644 --- a/po/xx_PL.po +++ b/po/xx_PL.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: libx52 0.2.3\n" "Report-Msgid-Bugs-To: https://github.com/nirenjan/libx52/issues\n" -"POT-Creation-Date: 2022-07-27 12:45-0700\n" +"POT-Creation-Date: 2022-08-31 20:39-0700\n" "PO-Revision-Date: 2022-07-27 12:45-0700\n" "Last-Translator: Nirenjan Krishnan \n" "Language-Team: Dummy Language for testing i18n\n" @@ -785,40 +785,40 @@ msgstr "Unableay otay avesay onfigcay ilefay %s - odecay %d: %s" msgid "Failed to dump %s.%s to config file %s" msgstr "Ailedfay otay umpday %s.%s otay onfigcay ilefay %s" -#: daemon/x52d_config_parser.c:168 +#: daemon/x52d_config_parser.c:172 #, c-format msgid "Ignoring unknown key '%s.%s'" msgstr "Ignoringay unknownay eykay '%s.%s'" -#: daemon/x52d_config_parser.c:209 +#: daemon/x52d_config_parser.c:213 #, c-format msgid "Failed processing configuration file %s - code %d" msgstr "Ailedfay ocessingpray onfigurationcay ilefay %s - odecay %d" -#: daemon/x52d_config_parser.c:239 +#: daemon/x52d_config_parser.c:243 msgid "Failed to allocate memory for override structure" msgstr "Ailedfay otay allocateay emorymay orfay overrideay ucturestray" -#: daemon/x52d_config_parser.c:248 +#: daemon/x52d_config_parser.c:252 msgid "Failed to allocate memory for override string" msgstr "Ailedfay otay allocateay emorymay orfay overrideay ingstray" -#: daemon/x52d_config_parser.c:259 +#: daemon/x52d_config_parser.c:263 #, c-format msgid "No section found in override string '%s'" msgstr "Onay ectionsay oundfay inay overrideay ingstray '%s'" -#: daemon/x52d_config_parser.c:273 +#: daemon/x52d_config_parser.c:277 #, c-format msgid "No key found in override string '%s'" msgstr "Onay eykay oundfay inay overrideay ingstray '%s'" -#: daemon/x52d_config_parser.c:284 +#: daemon/x52d_config_parser.c:288 #, c-format msgid "No value found in override string '%s'" msgstr "Onay aluevay oundfay inay overrideay ingstray '%s'" -#: daemon/x52d_config_parser.c:335 +#: daemon/x52d_config_parser.c:339 #, c-format msgid "Error processing override '%s.%s=%s'" msgstr "Erroray ocessingpray overriday '%s.%s=%s'"