diff --git a/hiredis.c b/hiredis.c index 5f56bf7..3ee0d0b 100644 --- a/hiredis.c +++ b/hiredis.c @@ -157,7 +157,7 @@ static void *createNilObject(const redisReadTask *task) { static char *readBytes(redisReader *r, unsigned int bytes) { char *p; - if (sdslen(r->buf)-r->pos >= bytes) { + if (r->len-r->pos >= bytes) { p = r->buf+r->pos; r->pos += bytes; return p;