diff options
author | antirez <antirez@gmail.com> | 2010-08-23 17:06:38 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2010-08-23 17:06:38 +0200 |
commit | c91abdcd077f868a59290bc9d68fba3130a3121d (patch) | |
tree | f22ed4a2a2b35da0609424aa02103eb5e1f3bbab /src/db.c | |
parent | cbce5171451eb53f1370aacc30decd74512347ac (diff) | |
download | redis-c91abdcd077f868a59290bc9d68fba3130a3121d.tar.gz |
Fixed overflow detection in argument to long convertion function in general, and in expire/ttl pairs specifically, addressing issue 54
Diffstat (limited to 'src/db.c')
-rw-r--r-- | src/db.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -514,15 +514,14 @@ void expireatCommand(redisClient *c) { } void ttlCommand(redisClient *c) { - time_t expire; - int ttl = -1; + time_t expire, ttl = -1; expire = getExpire(c->db,c->argv[1]); if (expire != -1) { - ttl = (int) (expire-time(NULL)); + ttl = (expire-time(NULL)); if (ttl < 0) ttl = -1; } - addReplySds(c,sdscatprintf(sdsempty(),":%d\r\n",ttl)); + addReplyLongLong(c,(long long)ttl); } void persistCommand(redisClient *c) { |