summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Erik Rediger <janerik@fnordig.de>2015-01-07 22:31:45 +0100
committerJan-Erik Rediger <janerik@fnordig.de>2015-01-07 22:31:45 +0100
commit04607b53500f71498a502ffcfc41a82792013e2b (patch)
treef5a7d04319bcc2b4101c483a6dfe8193a932fddd
parent9e718a1f57a18d685fc63cff9ffdeef3af734969 (diff)
downloadredis-04607b53500f71498a502ffcfc41a82792013e2b.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 2a703ad7f..e18cc7c9f 100644
--- a/src/redis-cli.c
+++ b/src/redis-cli.c
@@ -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;