Fix segv if only --reset option given
authorPete <petiepooo@gmail.com>
Mon, 10 Mar 2014 18:32:09 +0000 (14:32 -0400)
committerPete <petiepooo@gmail.com>
Mon, 10 Mar 2014 18:32:09 +0000 (14:32 -0400)
We didn't recheck that there are enough parameters after shifting the --reset option off the list.

flash/main.c

index 014b627e9da288df2c8434bdebf176228827ecd6..d550eeeeda9c158c34d6a06a0341d20aaf07ef14 100644 (file)
@@ -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;