]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: log/encode: fix potential NULL-dereference in LOGCHAR()
authorAurelien DARRAGON <adarragon@haproxy.com>
Mon, 29 Apr 2024 18:19:05 +0000 (20:19 +0200)
committerAurelien DARRAGON <adarragon@haproxy.com>
Tue, 30 Apr 2024 08:10:35 +0000 (10:10 +0200)
When CBOR encoding was added in c614fd3b9 ("MINOR: log: add +cbor encoding
option"), in LOGCHAR(), we forgot to check that we don't assign the NULL
value to tmplog (as we assume that tmplog cannot be NULL at the end of
sess_build_logline())

No backport needed.

src/log.c

index 31295d28888de90768965064712376b5f4ec65cb..3b78bc09e097fc8753de15d1aa3d192ce979e9f5 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -3163,6 +3163,8 @@ const char sess_set_cookie[8] = "NPDIRU67";       /* No set-cookie, Set-cookie found a
                                                       tmplog,                 \
                                                       dst + maxsize,          \
                                                       _x, sizeof(_x));        \
+                               if (ret == NULL)                               \
+                                       goto out;                              \
                                tmplog = ret;                                  \
                                break;                                         \
                        }                                                      \