mirror of https://github.com/OISF/suricata
output/alert: tolerate a reference with no key
Substitute an empty string for a NULL key or reference in AlertJsonReference() before the write, so the output no longer depends on what a libc does with a null pointer and "%s", which the standard leaves undefined. glibc prints "(null)"; nothing requires that. Assert both are set alongside the substitution. DetectReferenceParse() is the only producer of DetectReference and sets each string with its length, so the assert cannot fire today -- it names the invariant for a second producer that does not hold it, while the substitution covers a release build, where DEBUG_VALIDATE_BUG_ON compiles out. A release build that reaches the substitution logs whichever half it has rather than crashing, and nothing records that it happened. Issue: 8849pull/16165/head
parent
6216f9262c
commit
9cffa8ab49
Loading…
Reference in New Issue