From: Willy Tarreau Date: Wed, 5 Sep 2018 13:28:07 +0000 (+0200) Subject: MINOR: log: do not dereference a null stream to access captures X-Git-Tag: v1.9-dev2~88 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d4f9166f4e833eed47b380c555a04acd3a4441d2;p=thirdparty%2Fhaproxy.git MINOR: log: do not dereference a null stream to access captures If the stream is null, let's simply not check captures. That's already done if there is no capture. --- diff --git a/src/log.c b/src/log.c index f941c1bf9c..ca2f849c07 100644 --- 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(' ');