diff --git a/src/proto/nc_redis.c b/src/proto/nc_redis.c index a5ea210f900e8323bbf1d527c53d7c69c993187f..a80f84a31ec664df7907d2551d29b070096db51f 100644 --- a/src/proto/nc_redis.c +++ b/src/proto/nc_redis.c @@ -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;