BUG/MINOR: ssl: Do not free garbage pointers on memory allocation failure
authorTim Duesterhus <tim@bastelstu.be>
Thu, 19 Mar 2020 15:12:09 +0000 (16:12 +0100)
committerWilliam Lallemand <wlallemand@haproxy.org>
Fri, 20 Mar 2020 08:36:20 +0000 (09:36 +0100)
commit8c12025a7dacecfb6fe5c13bc899c6ffa2727ca1
tree73015d5b7254282484dc5a58f06bd711af5041f7
parentfdc7ee21739bfbdc2585dd3977d4ab3cb9a7df14
BUG/MINOR: ssl: Do not free garbage pointers on memory allocation failure

In `ckch_inst_sni_ctx_to_sni_filters` use `calloc()` to allocate the filter
array. When the function fails to allocate memory for a single entry the
whole array will be `free()`d using free_sni_filters(). With the previous
`malloc()` the pointers for entries after the failing allocation could
possibly be a garbage value.

This bug was introduced in commit 38df1c8006a2adf97f4ad5a183f80cfdcba3da8a,
which is 2.2+. No backport needed.
src/ssl_sock.c