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 488ee7fb6e4a388bb68153341826a6391da794e9
---
src/connection.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/connection.c b/src/connection.c
index f78028451..c156d9313 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -1098,12 +1098,11 @@ int conn_recv_proxy(struct connection *conn, int flag)
}
/* Verify that the PROXYv2 header ends at a TLV boundary.
- * This is technically unreachable, because the TLV parsing
already
- * verifies that a TLV does not exceed the total length and also
- * that there is space for a TLV header.
+ * This is can not be true, because the TLV parsing already
+ * verifies that a TLV does not exceed the total length and
+ * also that there is space for a TLV header.
*/
- if (tlv_offset != total_v2_len)
- goto bad_header;
+ BUG_ON(tlv_offset != total_v2_len);
/* unsupported protocol, keep local connection address */
break;
--
2.35.1