From: Pete Date: Mon, 10 Mar 2014 18:32:09 +0000 (-0400) Subject: Fix segv if only --reset option given X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=9b1c00452a251fe516dd0248fbdf05990d217710;p=fw%2Fstlink Fix segv if only --reset option given We didn't recheck that there are enough parameters after shifting the --reset option off the list. --- diff --git a/flash/main.c b/flash/main.c index 014b627..d550eee 100644 --- a/flash/main.c +++ b/flash/main.c @@ -48,6 +48,8 @@ static int get_opts(struct opts* o, int ac, char** av) { o->reset = 0; } + + if (ac < 1) return -1; /* stlinkv2 */ o->devname = NULL;