]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: ssl: check conn in keylog sample fetch
authorWilliam Lallemand <wlallemand@haproxy.com>
Tue, 7 Jul 2020 08:48:13 +0000 (10:48 +0200)
committerWilliam Lallemand <wlallemand@haproxy.org>
Tue, 7 Jul 2020 08:48:13 +0000 (10:48 +0200)
Add a check on the conn pointer to avoid a NULL dereference in
smp_fetch_ssl_x_keylog().

The problem is not suppose to happen because the function is only used
for the frontend at the moment.

Introduced by 7d42ef5, 2.2 only.

Fix issue #733.

src/ssl_sample.c

index 843554ceb7d9513be8f4e1ce6dbcf5df3a2b5d36..e53c08847f9b8436dcbefac84f3075269a4edf27 100644 (file)
@@ -1121,6 +1121,9 @@ static int smp_fetch_ssl_x_keylog(const struct arg *args, struct sample *smp, co
        conn = (kw[4] != 'b') ? objt_conn(smp->sess->origin) :
               smp->strm ? cs_conn(objt_cs(smp->strm->si[1].end)) : NULL;
 
+       if (!conn)
+               return 0;
+
        if (conn->flags & CO_FL_WAIT_XPRT) {
                smp->flags |= SMP_F_MAY_CHANGE;
                return 0;