mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 14:21:25 +02:00
BUG/MINOR: filters: Use filter offset to decude the amount of forwarded data
When the tcp or http payload is filtered, it is important to use the filter offset to decude the amount of forwarded data because this offset may change during the call to the callback function. So we should not rely on a local variable defined before this call. For now, existing HAproxy filters don't change this offset, so this bug may only affect external filters. This patch must be forwarded as far as 1.9.
This commit is contained in:
parent
24598a499f
commit
c50ee0b3b4
@ -626,8 +626,8 @@ flt_http_payload(struct stream *s, struct http_msg *msg, unsigned int len)
|
|||||||
ret = FLT_OPS(filter)->http_payload(s, filter, msg, out + offset, data - offset);
|
ret = FLT_OPS(filter)->http_payload(s, filter, msg, out + offset, data - offset);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto end;
|
goto end;
|
||||||
|
data = ret + *flt_off - *strm_off;
|
||||||
*flt_off += ret;
|
*flt_off += ret;
|
||||||
data = ret + offset;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -890,8 +890,8 @@ flt_tcp_payload(struct stream *s, struct channel *chn, unsigned int len)
|
|||||||
ret = FLT_OPS(filter)->tcp_payload(s, filter, chn, out + offset, data - offset);
|
ret = FLT_OPS(filter)->tcp_payload(s, filter, chn, out + offset, data - offset);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto end;
|
goto end;
|
||||||
|
data = ret + *flt_off - *strm_off;
|
||||||
*flt_off += ret;
|
*flt_off += ret;
|
||||||
data = ret + offset;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user