Skip to content

Commit

Permalink
fix parse eval on SW_ARG2 calculate r->rlen error (twitter#654)
Browse files Browse the repository at this point in the history
Update src/proto/nc_redis.c

Co-authored-by: Tyson Andre <[email protected]>
  • Loading branch information
kukey and TysonAndre authored Sep 26, 2021
1 parent 0cf49ad commit c3f433b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/proto/nc_redis.c
Original file line number Diff line number Diff line change
Expand Up @@ -1633,7 +1633,19 @@ redis_parse_req(struct msg *r)

m = p + r->rlen;
if (m >= b->last) {
r->rlen -= (uint32_t)(b->last - p);
/*
* For EVAL/EVALHASH, the r->token has been assigned a value. When
* m >= b->last happens will need to repair mbuf.
*
* At the end of redis_parse_req, r->token will be used to choose
* the start (p) for the next call to redis_parse_req and clear
* r->token when repairing this and adding more data.
*
* So, only when r->token == NULL we need to calculate r->rlen again.
*/
if (r->token == NULL) {
r->rlen -= (uint32_t)(b->last - p);
}
m = b->last - 1;
p = m;
break;
Expand Down

0 comments on commit c3f433b

Please sign in to comment.