summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2012-12-20 15:20:55 +0100
committerantirez <antirez@gmail.com>2012-12-20 15:21:37 +0100
commit4468ba231785fe9fda26f2d05181f91342d91c2d (patch)
treef4c3bc85aab34d4ab1bb798894b54cfceaca4c0c
parentd8a0fddd5104af56398a573d95da5e912255bf7e (diff)
downloadredis-4468ba231785fe9fda26f2d05181f91342d91c2d.tar.gz
Fix overflow in mstime() in redis-cli and benchmark.
The problem does not exist in the Redis server implementation of mstime() but is only limited to redis-cli and redis-benchmark. Thix fixes issue #839.
-rw-r--r--src/redis-benchmark.c2
-rw-r--r--src/redis-cli.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/redis-benchmark.c b/src/redis-benchmark.c
index 8d72573d5..ceab70723 100644
--- a/src/redis-benchmark.c
+++ b/src/redis-benchmark.c
@@ -106,7 +106,7 @@ static long long mstime(void) {
long long mst;
gettimeofday(&tv, NULL);
- mst = ((long)tv.tv_sec)*1000;
+ mst = ((long long)tv.tv_sec)*1000;
mst += tv.tv_usec/1000;
return mst;
}
diff --git a/src/redis-cli.c b/src/redis-cli.c
index e8c6be5e0..3969fbab5 100644
--- a/src/redis-cli.c
+++ b/src/redis-cli.c
@@ -95,7 +95,7 @@ static long long mstime(void) {
long long mst;
gettimeofday(&tv, NULL);
- mst = ((long)tv.tv_sec)*1000;
+ mst = ((long long)tv.tv_sec)*1000;
mst += tv.tv_usec/1000;
return mst;
}