mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 14:21:25 +02:00
[BUG] capture: do not capture a cookie if there is no memory left
In case of out of memory, it was possible to write to a null pointer when capturing response cookies due to a missing "else" block. The request handling was fine though. (cherry picked from commit 62e3604d7dd27741c0b4c9e27d9e7c73495dfc32)
This commit is contained in:
parent
e79c3b24fb
commit
f70fc75296
@ -6766,12 +6766,13 @@ void manage_server_side_cookies(struct session *t, struct buffer *res)
|
|||||||
if ((txn->srv_cookie = pool_alloc2(pool2_capture)) == NULL) {
|
if ((txn->srv_cookie = pool_alloc2(pool2_capture)) == NULL) {
|
||||||
Alert("HTTP logging : out of memory.\n");
|
Alert("HTTP logging : out of memory.\n");
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
if (log_len > t->fe->capture_len)
|
if (log_len > t->fe->capture_len)
|
||||||
log_len = t->fe->capture_len;
|
log_len = t->fe->capture_len;
|
||||||
memcpy(txn->srv_cookie, att_beg, log_len);
|
memcpy(txn->srv_cookie, att_beg, log_len);
|
||||||
txn->srv_cookie[log_len] = 0;
|
txn->srv_cookie[log_len] = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* now check if we need to process it for persistence */
|
/* now check if we need to process it for persistence */
|
||||||
if (!(t->flags & SN_IGNORE_PRST) &&
|
if (!(t->flags & SN_IGNORE_PRST) &&
|
||||||
|
Loading…
x
Reference in New Issue
Block a user