Skip to content

Commit

Permalink
hiredis udpated (RESP3 WIP).
Browse files Browse the repository at this point in the history
  • Loading branch information
antirez committed Sep 23, 2019
1 parent 2647084 commit 5e399d5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions deps/hiredis/hiredis.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,16 @@ static void *createStringObject(const redisReadTask *task, char *str, size_t len

/* Copy string value */
if (task->type == REDIS_REPLY_VERB) {
buf = malloc(len+4+1); /* Skip 4 bytes of verbatim type header. */
buf = malloc(len-4+1); /* Skip 4 bytes of verbatim type header. */
if (buf == NULL) {
freeReplyObject(r);
return NULL;
}
memcpy(r->vtype,buf,3);
memcpy(r->vtype,str,3);
r->vtype[3] = '\0';
memcpy(buf+4,str,len-4);
memcpy(buf,str+4,len-4);
buf[len-4] = '\0';
r->len = len-4;
} else {
buf = malloc(len+1);
if (buf == NULL) {
Expand All @@ -145,9 +146,9 @@ static void *createStringObject(const redisReadTask *task, char *str, size_t len
}
memcpy(buf,str,len);
buf[len] = '\0';
r->len = len;
}
r->str = buf;
r->len = len;

if (task->parent) {
parent = task->parent->obj;
Expand Down

0 comments on commit 5e399d5

Please sign in to comment.