Check that the whole first argument is a number

Fixes #2258
This commit is contained in:
Jan-Erik Rediger 2015-01-07 22:31:45 +01:00
parent 9e718a1f57
commit 04607b5350

View File

@ -977,9 +977,10 @@ static void repl(void) {
} else {
long long start_time = mstime(), elapsed;
int repeat, skipargs = 0;
char *endptr;
repeat = atoi(argv[0]);
if (argc > 1 && repeat) {
repeat = strtol(argv[0], &endptr, 10);
if (argc > 1 && *endptr == '\0' && repeat) {
skipargs = 1;
} else {
repeat = 1;