]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: quic/ssl: report SSL_CTX allocation failure
authorFrederic Lecaille <flecaille@haproxy.com>
Wed, 18 Nov 2026 14:36:42 +0000 (15:36 +0100)
committerFrederic Lecaille <flecaille@haproxy.com>
Wed, 18 Nov 2026 14:53:46 +0000 (15:53 +0100)
ssl_quic_initial_ctx() stores the result of SSL_CTX_new() into
bind_conf->initial_ctx without checking it, unlike ssl_sock_initial_ctx()
which alerts and returns an error. On allocation failure the QUIC bind
therefore crashed without any diagnostic.

Report the failure the same way the TCP path does.

Must be backported to all stable versions.

src/quic_ssl.c

index d22efef4370d1536dda1f813e255e725520e17fc..425a4333a9a8fb642fb3f352168c50ef5b2a0169 100644 (file)
@@ -760,6 +760,13 @@ int ssl_quic_initial_ctx(struct bind_conf *bind_conf)
        SSL_CTX *ctx;
 
        ctx = SSL_CTX_new(TLS_server_method());
+       if (!ctx) {
+               cfgerr += 1;
+               ha_alert("Proxy '%s': failed to create an SSL context for bind '%s' at [%s:%d].\n",
+                        bind_conf->frontend->id, bind_conf->arg, bind_conf->file, bind_conf->line);
+               goto end;
+       }
+
        bind_conf->initial_ctx = ctx;
 
        if (global_ssl.security_level > -1)
@@ -836,7 +843,7 @@ int ssl_quic_initial_ctx(struct bind_conf *bind_conf)
        }
 #endif
 
-
+ end:
        return cfgerr;
 }