From: Victor Julien Date: Tue, 20 Dec 2022 10:34:45 +0000 (+0100) Subject: app-layer: check name vs proto mapping in registration X-Git-Tag: suricata-7.0.0-rc1~202 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f6d388740a398d3ed218afe8ad8e111217a886e;p=thirdparty%2Fsuricata.git app-layer: check name vs proto mapping in registration --- 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);