BUG/MINOR: backend: do not call smp_make_safe for sni conn hash
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 17 Feb 2021 14:59:02 +0000 (15:59 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 17 Feb 2021 15:38:20 +0000 (16:38 +0100)
commit4c09800b760a7b37f9810d923046b5c30b1e1824
treebfe729a21f4c86d22d88d216ff8b682c6f26252d
parentffcd290dddd04603871e63718fca3b4db3f4fa82
BUG/MINOR: backend: do not call smp_make_safe for sni conn hash

conn_hash_prehash does not need a nul-terminated string, thus it is only
needed to test if the sni sample is not null before using it as
connection hash input.

Moreover, a bug could be introduced between smp_make_safe and
ssl_sock_set_servername call. Indeed, smp_make_safe may call smp_dup
which duplicates the sample in the trash buffer. If another function
manipulates the trash buffer before the call to ssl_sock_set_servername,
the sni sample might be erased. Currently, no function seems to do that
except make_proxy_line in case proxy protocol is used simultaneously
with the sni on the server.

This does not need to be backported.
src/backend.c