BUILD: ssl: can't build when using -DLISTEN_DEFAULT_CIPHERS
authorWilliam Lallemand <wlallemand@haproxy.com>
Fri, 17 Oct 2025 07:35:41 +0000 (09:35 +0200)
committerWilliam Lallemand <wlallemand@haproxy.com>
Fri, 17 Oct 2025 07:49:14 +0000 (09:49 +0200)
commit7e6696766b38d0858fe68aeee7b45420fe85fb3c
tree747345c7eb2484a572dd23a536c49e1c446f7f6a
parentb9fbb19629107e0d23366cefd3e2293fd4f76857
BUILD: ssl: can't build when using -DLISTEN_DEFAULT_CIPHERS

Emeric reported that he can't build haproxy anymore since 9bc6a034
("BUG/MINOR: ssl: Free global_ssl structure contents during deinit").

    src/ssl_sock.c:7020:40: error: comparison with string literal results in unspecified behavior [-Werror=address]
     7020 |  if (global_ssl.listen_default_ciphers != LISTEN_DEFAULT_CIPHERS)
          |                                        ^~
    src/ssl_sock.c:7023:41: error: comparison with string literal results in unspecified behavior [-Werror=address]
     7023 |  if (global_ssl.connect_default_ciphers != CONNECT_DEFAULT_CIPHERS)
          |                                         ^~
    src/ssl_sock.c: At top level:

Indeed the mentionned patch is checking the pointer in order to free
something freeable, but that can't work because these constant are
strings literal which can be passed from the compiler and not pointers.

Also the test is not useful, because these strings are strdup() in
__ssl_sock_init, so they can be free directly.

Must be backported in every stable branches with 9bc6a034.

(cherry picked from commit b74a437e576fa192b96c1f2bc90d67766376d751)
Signed-off-by: William Lallemand <wlallemand@haproxy.com>
(cherry picked from commit 594899a5eae5c203c677df312afa164682b2ab2c)
Signed-off-by: William Lallemand <wlallemand@haproxy.com>
(cherry picked from commit 6688f42e3253d80db0c2542dccd94d9a77287f1b)
Signed-off-by: William Lallemand <wlallemand@haproxy.com>
src/ssl_sock.c