http2: avoid null pointer deref in alert output

Bug #4120.
pull/5627/head
Victor Julien 5 years ago
parent 096dce4bba
commit a8fc481cd3

@ -167,13 +167,15 @@ static void AlertJsonHttp2(const Flow *f, const uint64_t tx_id, JsonBuilder *js)
void *h2_state = FlowGetAppState(f); void *h2_state = FlowGetAppState(f);
if (h2_state) { if (h2_state) {
void *tx_ptr = rs_http2_state_get_tx(h2_state, tx_id); void *tx_ptr = rs_http2_state_get_tx(h2_state, tx_id);
JsonBuilderMark mark = { 0, 0, 0 }; if (tx_ptr) {
jb_get_mark(js, &mark); JsonBuilderMark mark = { 0, 0, 0 };
jb_open_object(js, "http"); jb_get_mark(js, &mark);
if (rs_http2_log_json(tx_ptr, js)) { jb_open_object(js, "http");
jb_close(js); if (rs_http2_log_json(tx_ptr, js)) {
} else { jb_close(js);
jb_restore_mark(js, &mark); } else {
jb_restore_mark(js, &mark);
}
} }
} }

Loading…
Cancel
Save