flash/nor/tcl: fix segfault on write_image misuse
"flash write_image (unlock|erase)" (without filename) was causing segmentation fault in strcmp(). This patch fixes it. Change-Id: Ia3b8c796f4107621d78605c02d2b8e123b1b207b Reported-by: ajkroll][ <ajkroll][@irc.freenode.net> Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/1970 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
This commit is contained in:
parent
d2ddb53f7d
commit
58256d4835
|
@ -349,14 +349,11 @@ COMMAND_HANDLER(handle_flash_write_image_command)
|
||||||
|
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
if (CMD_ARGC < 1)
|
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
|
||||||
|
|
||||||
/* flash auto-erase is disabled by default*/
|
/* flash auto-erase is disabled by default*/
|
||||||
int auto_erase = 0;
|
int auto_erase = 0;
|
||||||
bool auto_unlock = false;
|
bool auto_unlock = false;
|
||||||
|
|
||||||
for (;; ) {
|
while (CMD_ARGC) {
|
||||||
if (strcmp(CMD_ARGV[0], "erase") == 0) {
|
if (strcmp(CMD_ARGV[0], "erase") == 0) {
|
||||||
auto_erase = 1;
|
auto_erase = 1;
|
||||||
CMD_ARGV++;
|
CMD_ARGV++;
|
||||||
|
|
Loading…
Reference in New Issue