From fdb587d2fc93ea82e69834f0df6b6e78c2bf4557 Mon Sep 17 00:00:00 2001 From: Jason Ish Date: Mon, 25 Nov 2019 16:57:06 -0600 Subject: [PATCH] detect-engine: check for tx detect flag support When registing a detection engine, check that the app-layer protocol supports tx detect flags. Exit with a fatal error if it does not as this is a code implementation error that should be resolved during development. --- src/detect-engine.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/detect-engine.c b/src/detect-engine.c index fac0a8a7a6..f1fca6235c 100644 --- a/src/detect-engine.c +++ b/src/detect-engine.c @@ -171,6 +171,13 @@ void DetectAppLayerInspectEngineRegister(const char *name, AppProto alproto, uint32_t dir, int progress, InspectEngineFuncPtr Callback) { + if (AppLayerParserIsTxAware(alproto)) { + if (!AppLayerParserSupportsTxDetectFlags(alproto)) { + FatalError(SC_ERR_INITIALIZATION, + "Inspect engine registered for app-layer protocol without " + "TX detect flag support: %s", AppProtoToString(alproto)); + } + } DetectBufferTypeRegister(name); const int sm_list = DetectBufferTypeGetByName(name); if (sm_list == -1) {