X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/56fce7ce7d598def0ea15313635eb8a74d781bdd..d8d528e9926d712cf02617dcdb6e9bde90e4e49c:/deps/hiredis/hiredis.c diff --git a/deps/hiredis/hiredis.c b/deps/hiredis/hiredis.c index 66789d0f..898b4d6a 100644 --- a/deps/hiredis/hiredis.c +++ b/deps/hiredis/hiredis.c @@ -164,8 +164,17 @@ static char *readBytes(redisReader *r, unsigned int bytes) { static char *seekNewline(char *s) { /* Find pointer to \r\n without strstr */ - while(s != NULL && s[0] != '\r' && s[1] != '\n') + while (s != NULL) { s = strchr(s,'\r'); + if (s != NULL) { + if (s[1] == '\n') + break; + else + s++; + } else { + break; + } + } return s; } @@ -424,7 +433,7 @@ char *redisReplyReaderGetError(void *reader) { return r->error; } -void redisReplyReaderFeed(void *reader, char *buf, int len) { +void redisReplyReaderFeed(void *reader, char *buf, size_t len) { redisReader *r = reader; /* Copy the provided buffer. */ @@ -655,6 +664,7 @@ void __redisSetError(redisContext *c, int type, const sds errstr) { static redisContext *redisContextInit() { redisContext *c = calloc(sizeof(redisContext),1); + c->fd = -1; /* quick fix for a bug that should be addressed differently */ c->err = 0; c->errstr = NULL; c->obuf = sdsempty();