Only call strtoul when there is an argument that strtoul can work on
authorUwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Sat, 10 Dec 2011 16:15:48 +0000 (17:15 +0100)
committerUwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Sat, 10 Dec 2011 16:15:48 +0000 (17:15 +0100)
flash/main.c

index 8781941cc780a4074917e9685d5ec8ab6ede2a77..39910b63665ad388c658951ad43bf6db7639571b 100644 (file)
@@ -48,8 +48,8 @@ static int get_opts(struct opts* o, int ac, char** av)
       o->devname = av[1];
       i = 1;
     }
-
-    o->size = strtoul(av[i + 3], NULL, 16);
+    if (ac > 3)
+       o->size = strtoul(av[i + 3], NULL, 16);
   }
   else if (strcmp(av[0], "write") == 0)
   {