BUG/CRITICAL: log: fix risk of crash in development snapshot
authorWilly Tarreau <w@1wt.eu>
Mon, 19 Mar 2012 15:51:53 +0000 (16:51 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 19 Mar 2012 16:09:30 +0000 (17:09 +0100)
commitb1a2faf7c9dac8ca409d101156512b2ff4762bba
treec84c719159de12a607ba1cbcc1875664f2c94c16
parent6580c06ba3f78a0ba0084a4cdee2830a2782285b
BUG/CRITICAL: log: fix risk of crash in development snapshot

Commit a1cc38 introduced a regression which was easy to trigger till ad4cd58
(snapshots 20120222 to 20120311 included). The bug was still present after
that but harder to trigger.

The bug is caused by the use of two distinct log buffers due to intermediary
changes. The issue happens when an HTTP request is logged just after a TCP
request during the same second and the HTTP request is too large for the buffer.
In this case, it happens that the HTTP request is logged into the TCP buffer
instead and that length controls can't detect anything.

Starting with bddd4f, the issue is still possible when logging too large an
HTTP request just after a send_log() call (typically a server status change).

We owe a big thanks to Sander Klein for testing several snapshots and more
specifically for taking significant risks in production by letting the buggy
version crash several times in order to provide an exploitable core ! The bug
could not have been found without this precious help. Thank you Sander !

This fix does not need to be backported, it did not affect any released version.
include/proto/log.h
src/log.c