diff --git a/src/output-json-alert.c b/src/output-json-alert.c index 652515a996..7d2c6b8222 100644 --- a/src/output-json-alert.c +++ b/src/output-json-alert.c @@ -572,7 +572,12 @@ void EveAddVerdict(SCJsonBuilder *jb, const Packet *p) JB_SET_STRING(jb, "action", "drop"); } else if (PacketCheckAction(p, ACTION_ACCEPT)) { JB_SET_STRING(jb, "action", "accept"); - } else if (p->alerts.alerts[p->alerts.cnt].action & ACTION_PASS) { + } else if (p->alerts.cnt == 0 || + (p->alerts.cnt <= packet_alert_max && + (p->alerts.alerts[p->alerts.cnt - 1].action & + (ACTION_PASS | ACTION_ALERT)) == (ACTION_PASS | ACTION_ALERT)) || + (p->alerts.cnt < packet_alert_max && + p->alerts.alerts[p->alerts.cnt].action & ACTION_PASS)) { JB_SET_STRING(jb, "action", "pass"); } else { // TODO make sure we don't have a situation where this wouldn't work