From 589d297d20e520fa087fe37e3ceea7b01c99c8f1 Mon Sep 17 00:00:00 2001 From: Uwe Bonnes Date: Wed, 12 Jun 2019 12:37:01 +0200 Subject: [PATCH] stm32l0: Fix crash when only "monitor option" was requested. PR #485 --- src/target/stm32l0.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/target/stm32l0.c b/src/target/stm32l0.c index 388becf..4c8118e 100644 --- a/src/target/stm32l0.c +++ b/src/target/stm32l0.c @@ -609,6 +609,8 @@ static bool stm32lx_cmd_option(target* t, int argc, char** argv) return true; } + if (argc < 2 ) + goto usage; size_t cb = strlen(argv[1]); if (argc == 2 && !strncasecmp(argv[1], "obl_launch", cb)) { @@ -638,10 +640,6 @@ static bool stm32lx_cmd_option(target* t, int argc, char** argv) if (!stm32lx_option_write(t, addr, val)) tc_printf(t, "option write failed\n"); } - else if (argc == 2 && !strncasecmp(argv[1], "show", cb)) - ; - else - goto usage; /* Report the current option values */ for(unsigned i = 0; i < opt_size; i += sizeof(uint32_t)) {