summaryrefslogtreecommitdiffstatshomepage
path: root/src/tools
diff options
context:
space:
mode:
author Lubomir Rintel <lkundrak@v3.sk>2023-10-29 12:55:07 +0100
committer GitHub <noreply@github.com>2023-10-29 07:55:07 -0400
commit6ffb5630844db2a7074258bd95609efa5edd73c2 (patch)
tree3aec05b7b5e4916c0b655f00482dc18980058c7f /src/tools
parentc40d893239f79d825ce075f4a3e94588c933e285 (diff)
imgtool: check for unrecognized options (#11671)
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/imgtool/main.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/tools/imgtool/main.cpp b/src/tools/imgtool/main.cpp
index 8dd6affbc43..9777a8b35f8 100644
--- a/src/tools/imgtool/main.cpp
+++ b/src/tools/imgtool/main.cpp
@@ -115,6 +115,9 @@ static int parse_options(int argc, char *argv[], int minunnamed, int maxunnamed,
goto error; /* Too few unnamed */
util::option_resolution::entry *entry = resolution->find(name);
+ if (entry == nullptr)
+ goto error; /* Unknown option */
+
if (entry->option_type() == util::option_guide::entry::option_type::ENUM_BEGIN)
{
const util::option_guide::entry *enum_value;