From: Victor Julien Date: Sat, 7 Nov 2020 14:34:35 +0000 (+0100) Subject: http2: avoid null pointer deref in alert output X-Git-Tag: suricata-6.0.1~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8fc481cd3f2e006350c8bbac1a96ffd7bfe5f9a;p=thirdparty%2Fsuricata.git http2: avoid null pointer deref in alert output Bug #4120. --- diff --git a/src/output-json-alert.c b/src/output-json-alert.c index 426a441140..dc2714669f 100644 --- a/src/output-json-alert.c +++ b/src/output-json-alert.c @@ -167,13 +167,15 @@ static void AlertJsonHttp2(const Flow *f, const uint64_t tx_id, JsonBuilder *js) void *h2_state = FlowGetAppState(f); if (h2_state) { void *tx_ptr = rs_http2_state_get_tx(h2_state, tx_id); - JsonBuilderMark mark = { 0, 0, 0 }; - jb_get_mark(js, &mark); - jb_open_object(js, "http"); - if (rs_http2_log_json(tx_ptr, js)) { - jb_close(js); - } else { - jb_restore_mark(js, &mark); + if (tx_ptr) { + JsonBuilderMark mark = { 0, 0, 0 }; + jb_get_mark(js, &mark); + jb_open_object(js, "http"); + if (rs_http2_log_json(tx_ptr, js)) { + jb_close(js); + } else { + jb_restore_mark(js, &mark); + } } }