From 9a294bf73b9fcc4b5dd089dc0b351fbcda187549 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Thu, 2 Jul 2026 10:13:00 +0200 Subject: [PATCH] app-layer: check if protocol is enabled for sub state callbacks --- src/app-layer-parser.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/app-layer-parser.c b/src/app-layer-parser.c index c746588249..051ed6be26 100644 --- a/src/app-layer-parser.c +++ b/src/app-layer-parser.c @@ -1264,11 +1264,15 @@ uint8_t AppLayerParserGetStateProgressCompletionStatus(AppProto alproto, uint8_t * registered callbacks. * * \retval -1 not found + * \retval -2 parser is not enabled * \retval id value belonging to the state name */ int8_t AppLayerParserGetSubStateProgressId( const AppProto alproto, const uint8_t sub_state, const char *state, const uint8_t dir_flag) { + if (!AppLayerParserIsEnabled(alproto)) + return -2; + if (alproto == ALPROTO_DOH2) return AppLayerParserGetSubStateProgressId(ALPROTO_HTTP2, sub_state, state, dir_flag); @@ -1299,6 +1303,9 @@ int8_t AppLayerParserGetSubStateProgressId( const char *AppLayerParserGetSubStateProgressName(const AppProto alproto, const uint8_t sub_state, const uint8_t state, const uint8_t dir_flag) { + if (!AppLayerParserIsEnabled(alproto)) + return NULL; + if (alproto == ALPROTO_DOH2) return AppLayerParserGetSubStateProgressName(ALPROTO_HTTP2, sub_state, state, dir_flag); @@ -1321,6 +1328,9 @@ const char *AppLayerParserGetSubStateProgressName(const AppProto alproto, const uint8_t AppLayerParserGetSubStateCompletion(const AppProto alproto, const uint8_t sub_state) { + if (!AppLayerParserIsEnabled(alproto)) + return 0; + if (alproto == ALPROTO_DOH2) return AppLayerParserGetSubStateCompletion(ALPROTO_HTTP2, sub_state); @@ -1341,6 +1351,9 @@ uint8_t AppLayerParserGetSubStateCompletion(const AppProto alproto, const uint8_ const char *AppLayerParserGetSubStateName(const AppProto alproto, const uint8_t sub_state) { + if (!AppLayerParserIsEnabled(alproto)) + return NULL; + if (alproto == ALPROTO_DOH2) return AppLayerParserGetSubStateName(ALPROTO_HTTP2, sub_state);