From 4f6d388740a398d3ed218afe8ad8e111217a886e Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Tue, 20 Dec 2022 11:34:45 +0100 Subject: [PATCH] app-layer: check name vs proto mapping in registration --- src/app-layer-register.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/app-layer-register.c b/src/app-layer-register.c index 7233bf4b7f..c4441d9f7c 100644 --- a/src/app-layer-register.c +++ b/src/app-layer-register.c @@ -47,6 +47,8 @@ AppProto AppLayerRegisterProtocolDetection(const struct AppLayerParser *p, int e if (alproto == ALPROTO_UNKNOWN || alproto == ALPROTO_FAILED) FatalError("Unknown or invalid AppProto '%s'.", p->name); + BUG_ON(strcmp(p->name, AppProtoToString(alproto)) != 0); + ip_proto_str = IpProtoToString(p->ip_proto); if (ip_proto_str == NULL) FatalError("Unknown or unsupported ip_proto field in parser '%s'", p->name); @@ -102,6 +104,8 @@ int AppLayerRegisterParser(const struct AppLayerParser *p, AppProto alproto) if (alproto == ALPROTO_UNKNOWN || alproto >= ALPROTO_FAILED) FatalError("Unknown or invalid AppProto '%s'.", p->name); + BUG_ON(strcmp(p->name, AppProtoToString(alproto)) != 0); + ip_proto_str = IpProtoToString(p->ip_proto); if (ip_proto_str == NULL) FatalError("Unknown or unsupported ip_proto field in parser '%s'", p->name);