summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Erik Rediger <janerik@fnordig.de>2015-01-07 22:31:45 +0100
committerantirez <antirez@gmail.com>2017-07-24 15:21:44 +0200
commitbf50875353a1ba57ad09d89828383250cee62562 (patch)
tree82462e661d783ab0ffc2e0a67fa1f35841acfb65
parent8774228cc5c2d3f60f430f81a4b005f78d5760a9 (diff)
downloadredis-bf50875353a1ba57ad09d89828383250cee62562.tar.gz
Check that the whole first argument is a number
Fixes #2258
-rw-r--r--src/redis-cli.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/redis-cli.c b/src/redis-cli.c
index 3c7114024..1b6cebd31 100644
--- a/src/redis-cli.c
+++ b/src/redis-cli.c
@@ -1330,9 +1330,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;