]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: ssl_sock: bind_conf uninitialized in ssl_sock_bind_verifycbk()
authorFrédéric Lécaille <flecaille@haproxy.com>
Fri, 14 Oct 2022 07:34:00 +0000 (09:34 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 14 Oct 2022 08:25:11 +0000 (10:25 +0200)
Even if this cannot happen, ensure <bind_conf> is initialized in this
function to please some compilers.

Takes the opportunity of this patch to replace an ABORT_NOW() by
a BUG_ON() because if the variable values they test are not initialized,
this is really because there is a bug.

Must be backported to 2.6.

src/ssl_sock.c

index 8d201909907a38a26a60d42d87b2a67a6803c5e5..fbf4ee6a35db79fac52ae5bb8217768947fde359 100644 (file)
@@ -1713,7 +1713,7 @@ int ssl_sock_bind_verifycbk(int ok, X509_STORE_CTX *x_store)
        int err, depth;
        X509 *client_crt;
        STACK_OF(X509) *certs;
-       struct bind_conf *bind_conf;
+       struct bind_conf *bind_conf = NULL;
        struct quic_conn *qc = NULL;
 
        ssl = X509_STORE_CTX_get_ex_data(x_store, SSL_get_ex_data_X509_STORE_CTX_idx());
@@ -1734,10 +1734,7 @@ int ssl_sock_bind_verifycbk(int ok, X509_STORE_CTX *x_store)
        }
 #endif
 
-       if (!ctx || !bind_conf) {
-               /* Must never happen */
-               ABORT_NOW();
-       }
+       BUG_ON(!ctx || !bind_conf);
 
        ctx->xprt_st |= SSL_SOCK_ST_FL_VERIFY_DONE;