Check if stroll return value was clamped

This commit is contained in:
Pieter Noordhuis
2010-08-20 13:42:42 +02:00
parent aaada3f962
commit 87c74dfaa8
2 changed files with 7 additions and 0 deletions

View File

@ -375,6 +375,7 @@ int getLongLongFromObject(robj *o, long long *target) {
redisAssert(o->type == REDIS_STRING);
if (o->encoding == REDIS_ENCODING_RAW) {
value = strtoll(o->ptr, &eptr, 10);
if (errno == ERANGE) return REDIS_ERR;
if (eptr[0] != '\0') return REDIS_ERR;
} else if (o->encoding == REDIS_ENCODING_INT) {
value = (long)o->ptr;