mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-10 00:57:02 +02:00
MINOR: connection: Transform safety check in PROXYv2 parsing into BUG_ON()
With BUG_ON() being enabled by default it is more useful to use a BUG_ON()
instead of an effectively never-taken if, as any incorrect assumptions will
become much more visible.
see 488ee7fb6
("BUG/MAJOR: proxy_protocol: Properly validate TLV lengths")
This commit is contained in:
parent
f09af57df5
commit
17e6b737d7
@ -1098,12 +1098,11 @@ int conn_recv_proxy(struct connection *conn, int flag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Verify that the PROXYv2 header ends at a TLV boundary.
|
/* Verify that the PROXYv2 header ends at a TLV boundary.
|
||||||
* This is technically unreachable, because the TLV parsing already
|
* This is can not be true, because the TLV parsing already
|
||||||
* verifies that a TLV does not exceed the total length and also
|
* verifies that a TLV does not exceed the total length and
|
||||||
* that there is space for a TLV header.
|
* also that there is space for a TLV header.
|
||||||
*/
|
*/
|
||||||
if (tlv_offset != total_v2_len)
|
BUG_ON(tlv_offset != total_v2_len);
|
||||||
goto bad_header;
|
|
||||||
|
|
||||||
/* unsupported protocol, keep local connection address */
|
/* unsupported protocol, keep local connection address */
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user