Commit bf508753 authored by Jan-Erik Rediger's avatar Jan-Erik Rediger Committed by antirez
Browse files

Check that the whole first argument is a number

Fixes #2258
parent 8774228c
...@@ -1330,9 +1330,10 @@ static void repl(void) { ...@@ -1330,9 +1330,10 @@ static void repl(void) {
} else { } else {
long long start_time = mstime(), elapsed; long long start_time = mstime(), elapsed;
int repeat, skipargs = 0; int repeat, skipargs = 0;
char *endptr;
repeat = atoi(argv[0]); repeat = strtol(argv[0], &endptr, 10);
if (argc > 1 && repeat) { if (argc > 1 && *endptr == '\0' && repeat) {
skipargs = 1; skipargs = 1;
} else { } else {
repeat = 1; repeat = 1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment