]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: log: do not dereference a null stream to access captures
authorWilly Tarreau <w@1wt.eu>
Wed, 5 Sep 2018 13:28:07 +0000 (15:28 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 5 Sep 2018 18:01:23 +0000 (20:01 +0200)
If the stream is null, let's simply not check captures. That's already
done if there is no capture.

src/log.c

index f941c1bf9c3ca56416e6b6fd9c04cb3b82a2736b..ca2f849c07f4b716fb9e546db31b36d66b410913 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -2148,7 +2148,7 @@ int sess_build_logline(struct session *sess, struct stream *s, char *dst, size_t
 
                        case LOG_FMT_HDRREQUEST: // %hr
                                /* request header */
-                               if (fe->nb_req_cap && s->req_cap) {
+                               if (fe->nb_req_cap && s && s->req_cap) {
                                        if (tmp->options & LOG_OPT_QUOTE)
                                                LOGCHAR('"');
                                        LOGCHAR('{');
@@ -2172,7 +2172,7 @@ int sess_build_logline(struct session *sess, struct stream *s, char *dst, size_t
 
                        case LOG_FMT_HDRREQUESTLIST: // %hrl
                                /* request header list */
-                               if (fe->nb_req_cap && s->req_cap) {
+                               if (fe->nb_req_cap && s && s->req_cap) {
                                        for (hdr = 0; hdr < fe->nb_req_cap; hdr++) {
                                                if (hdr > 0)
                                                        LOGCHAR(' ');
@@ -2196,7 +2196,7 @@ int sess_build_logline(struct session *sess, struct stream *s, char *dst, size_t
 
                        case LOG_FMT_HDRRESPONS: // %hs
                                /* response header */
-                               if (fe->nb_rsp_cap && s->res_cap) {
+                               if (fe->nb_rsp_cap && s && s->res_cap) {
                                        if (tmp->options & LOG_OPT_QUOTE)
                                                LOGCHAR('"');
                                        LOGCHAR('{');
@@ -2220,7 +2220,7 @@ int sess_build_logline(struct session *sess, struct stream *s, char *dst, size_t
 
                        case LOG_FMT_HDRRESPONSLIST: // %hsl
                                /* response header list */
-                               if (fe->nb_rsp_cap && s->res_cap) {
+                               if (fe->nb_rsp_cap && s && s->res_cap) {
                                        for (hdr = 0; hdr < fe->nb_rsp_cap; hdr++) {
                                                if (hdr > 0)
                                                        LOGCHAR(' ');