diff options
author | Martin Mathieson <martin.mathieson@keysight.com> | 2021-03-06 13:07:51 +0000 |
---|---|---|
committer | Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org> | 2021-03-09 19:14:29 +0000 |
commit | 2753c4c27e862d4d1eebd377232dd49662cf8667 (patch) | |
tree | 36c254b408629e52aa19067cff1a9034449622dc /epan/expert.c | |
parent | ce786ed26528f8f39f28608afffab132909da6eb (diff) |
Expert info: check group and severity
Add a check for valid group and severity values, and fix violations foud.
Diffstat (limited to 'epan/expert.c')
-rw-r--r-- | epan/expert.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/epan/expert.c b/epan/expert.c index 51a6d382cf..8052d04047 100644 --- a/epan/expert.c +++ b/epan/expert.c @@ -353,6 +353,37 @@ expert_free_deregistered_expertinfos (void) static int expert_register_field_init(expert_field_info *expinfo, expert_module_t *module) { + /* Check for valid group and severity vals */ + switch (expinfo->group) { + case PI_CHECKSUM: + case PI_SEQUENCE: + case PI_RESPONSE_CODE: + case PI_REQUEST_CODE: + case PI_UNDECODED: + case PI_REASSEMBLE: + case PI_MALFORMED: + case PI_DEBUG: + case PI_PROTOCOL: + case PI_SECURITY: + case PI_COMMENTS_GROUP: + case PI_DECRYPTION: + case PI_ASSUMPTION: + case PI_DEPRECATED: + break; + default: + REPORT_DISSECTOR_BUG("Expert info for %s has invalid group=0x%08x\n", expinfo->name, expinfo->group); + } + switch (expinfo->severity) { + case PI_COMMENT: + case PI_CHAT: + case PI_NOTE: + case PI_WARN: + case PI_ERROR: + break; + default: + REPORT_DISSECTOR_BUG("Expert info for %s has invalid severity=0x%08x\n", expinfo->name, expinfo->severity); + } + expinfo->protocol = module->proto_name; /* if we always add and never delete, then id == len - 1 is correct */ |