summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSalvatore Sanfilippo <antirez@gmail.com>2017-07-24 15:19:53 +0200
committerGitHub <noreply@github.com>2017-07-24 15:19:53 +0200
commit6b64cc47a07005af1c3dfff7469d76e2ed1a8ea7 (patch)
tree3256ebda23f67f6246c1c7bc8d33ff1f66c64cfe
parent964224b77fb4361e337d2f679fd4e6ccb2fa33c0 (diff)
parent04607b53500f71498a502ffcfc41a82792013e2b (diff)
downloadredis-6b64cc47a07005af1c3dfff7469d76e2ed1a8ea7.tar.gz
Merge pull request #2259 from badboy/fix-2258
Check that the whole first argument is a number
-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 f8f945235..61068483f 100644
--- a/src/redis-cli.c
+++ b/src/redis-cli.c
@@ -1338,9 +1338,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;