BUG/MAJOR: connection: fix TLV offset calculation for proxy protocol v2 parsing
authorKOVACS Krisztian <hidden@balabit.com>
Fri, 3 Jul 2015 12:09:10 +0000 (14:09 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 3 Jul 2015 15:05:20 +0000 (17:05 +0200)
commit7209c204bd6f3c49132264c7a58f689cdc741c12
treeaf7e2b2c38e279db87f84aca95507653f16a9611
parent27187ab56a2f1104818c2f21c5139c1edd8b838f
BUG/MAJOR: connection: fix TLV offset calculation for proxy protocol v2 parsing

Until now, the code assumed that it can get the offset to the first TLV
header just by subtracting the length of the TLV part from the length of
the complete buffer. However, if the buffer contains actual data after
the header, this computation is flawed and leads to haproxy trying to
parse TLV headers from the proxied data.

This change fixes this by making sure that the offset to the first TLV
header is calculated based from the start of the buffer -- simply by
adding the size of the proxy protocol v2 header plus the address
family-dependent size of the address information block.
src/connection.c