mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-11 16:29:36 +00:00
[BUG] fix wrong pointer arithmetics in HTTP message captures
The pointer arithmetics was wrong in http_capture_bad_message(). This has no impact right now because the error only msg->som was affected and right now it's always 0. But this was a bug waiting for keepalive support to strike.
This commit is contained in:
parent
79e9989196
commit
2df8d713b3
@ -4392,14 +4392,12 @@ void http_capture_bad_message(struct error_snapshot *es, struct session *s,
|
|||||||
struct buffer *buf, struct http_msg *msg,
|
struct buffer *buf, struct http_msg *msg,
|
||||||
struct proxy *other_end)
|
struct proxy *other_end)
|
||||||
{
|
{
|
||||||
int maxlen = MIN(buf->r - buf->data + msg->som, sizeof(es->buf));
|
es->len = buf->r - (buf->data + msg->som);
|
||||||
|
memcpy(es->buf, buf->data + msg->som, MIN(es->len, sizeof(es->buf)));
|
||||||
memcpy(es->buf, buf->data + msg->som, maxlen);
|
|
||||||
if (msg->err_pos >= 0)
|
if (msg->err_pos >= 0)
|
||||||
es->pos = msg->err_pos + msg->som;
|
es->pos = msg->err_pos - msg->som;
|
||||||
else
|
else
|
||||||
es->pos = buf->lr - buf->data + msg->som;
|
es->pos = buf->lr - (buf->data + msg->som);
|
||||||
es->len = buf->r - buf->data + msg->som;
|
|
||||||
es->when = date; // user-visible date
|
es->when = date; // user-visible date
|
||||||
es->sid = s->uniq_id;
|
es->sid = s->uniq_id;
|
||||||
es->srv = s->srv;
|
es->srv = s->srv;
|
||||||
|
Loading…
Reference in New Issue
Block a user