]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic-be: Avoid SSL context unreachable code without USE_QUIC_OPENSSL_COMPAT
authorFrederic Lecaille <flecaille@haproxy.com>
Thu, 12 Jun 2025 09:17:18 +0000 (11:17 +0200)
committerFrederic Lecaille <flecaille@haproxy.com>
Thu, 12 Jun 2025 09:45:21 +0000 (11:45 +0200)
This commit added a "err" C label reachable only with USE_QUIC_OPENSSL_COMPAT:

   MINOR: quic-be: Missing callbacks initializations (USE_QUIC_OPENSSL_COMPAT)

leading coverity to warn this:

*** CID 1611481:         Control flow issues  (UNREACHABLE)
/src/quic_ssl.c: 802             in ssl_quic_srv_new_ssl_ctx()
796      goto err;
797     #endif
798
799      leave:
800      TRACE_LEAVE(QUIC_EV_CONN_NEW);
801      return ctx;
>>>     CID 1611481:         Control flow issues  (UNREACHABLE)
>>>     This code cannot be reached: "err:
SSL_CTX_free(ctx);".
802      err:
803      SSL_CTX_free(ctx);
804      ctx = NULL;
805      TRACE_DEVEL("leaving on error", QUIC_EV_CONN_NEW);
806      goto leave;
807     }

The less intrusive (without #ifdef) way to fix this it to add a "goto err"
statement from the code part which is reachable without USE_QUIC_OPENSSL_COMPAT.

Thank you to @chipitsine for having reported this issue in GH #3003.

src/quic_ssl.c

index 3341e03cb50c7fde8ecac131d79a69e80348b276..21c4237aa8e17cbaa81d454d1791887d33ea96a6 100644 (file)
@@ -785,7 +785,7 @@ SSL_CTX *ssl_quic_srv_new_ssl_ctx(void)
        ctx = SSL_CTX_new(TLS_client_method());
        if (!ctx) {
                TRACE_ERROR("Could not allocate a new TLS context", QUIC_EV_CONN_NEW);
-               goto leave;
+               goto err;
        }
 
        SSL_CTX_set_options(ctx, options);