Skip to content

Commit ddd50bd

Browse files
committed
Add missing asserts for command line argument cases
1 parent 086fd8e commit ddd50bd

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

CommandLine.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ static CommandLineStatus parseArguments(int argc, char** argv, CommandLineSettin
214214
}
215215
break;
216216
case 'd':
217+
assert(optarg);
217218
if (sscanf(optarg, "%16d", &(flags->delay)) == 1) {
218219
if (flags->delay < 1)
219220
flags->delay = 1;
@@ -225,6 +226,7 @@ static CommandLineStatus parseArguments(int argc, char** argv, CommandLineSettin
225226
}
226227
break;
227228
case 'n':
229+
assert(optarg);
228230
if (sscanf(optarg, "%16d", &flags->iterationsRemaining) == 1) {
229231
if (flags->iterationsRemaining <= 0) {
230232
fprintf(stderr, "Error: maximum iteration count must be positive.\n");

0 commit comments

Comments
 (0)