BUG/MAJOR: server: the "sni" directive could randomly cause trouble
authorWilly Tarreau <w@1wt.eu>
Tue, 9 Aug 2016 09:55:21 +0000 (11:55 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 9 Aug 2016 12:30:57 +0000 (14:30 +0200)
commit2e0565cc09517195ed50d5a121852b654c9d2b97
tree8e4d58d7df87f61b5bd76d15e065c9c565c8d42f
parent77128f585ce682ebc14f063f4b91c8cdecf4e4b8
BUG/MAJOR: server: the "sni" directive could randomly cause trouble

The "sni" server directive does some bad stuff on many occasions because
it works on a sample of type string and limits len to size-1 by hand. The
problem is that size used to be zero on many occasions before the recent
changes to smp_dup() and that it effectively results in setting len to -1
and writing the zero byte *before* the string (and not terminating the
string).

This patch makes use of the recently introduced smp_make_safe() to address
this issue.

This fix must be backported to 1.6.
src/backend.c