diff options
author | Gerald Combs <gerald@wireshark.org> | 2021-11-06 13:52:01 -0700 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2021-11-08 22:20:24 +0000 |
commit | 846b17ee9a5398d94da4aa465f8d5f462914b6c6 (patch) | |
tree | fc0c74b5dbe8838be0f52b4f68d2a4a326013dc2 /epan/uat_load.l | |
parent | 6e4e4ebd504845ea3569368441ec894e4fbde40a (diff) |
UAT: Allow extra fields.
If we encounter unexpected extra fields on a line, simply log a warning
and continue instead of returning an error. This allows forward
compatibility when we add a field to a UAT. We end up throwing away the
extra fields, but it's better than resetting the entire UAT. Fixes the
forward compatibility issue described in #17623.
Diffstat (limited to 'epan/uat_load.l')
-rw-r--r-- | epan/uat_load.l | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/epan/uat_load.l b/epan/uat_load.l index abc60d7734..3c46476f3c 100644 --- a/epan/uat_load.l +++ b/epan/uat_load.l @@ -2,6 +2,10 @@ /* Include this before everything else, for various large-file definitions */ #include "config.h" #include <wireshark.h> + +#define WS_LOG_DOMAIN LOG_DOMAIN_UAT + +/* #define DEBUG_UAT_LOAD 1 */ } /* @@ -214,6 +218,7 @@ typedef struct { %} quoted_string \042([^\042]|\134\042)*\042 +extra_records_string (\042.*\042) binstring ([0-9a-zA-Z][0-9a-zA-Z])* separator [ \t]*, newline [ \t]*[\r]?\n @@ -301,8 +306,10 @@ comment #[^\n]*\n ERROR(("unexpected char '%s' while looking for field %s",yytext,yyextra->uat->fields[yyextra->colnum].name)); } -<END_OF_RECORD>{separator} { - ERROR(("more fields than required")); +<END_OF_RECORD>{separator}{extra_records_string} { + /* If we wanted to be really fancy we could retain the extra data. */ + ws_log(WS_LOG_DOMAIN, LOG_LEVEL_WARNING, "%s:%d: More fields than required. Discarding '%s'.", + yyextra->uat->filename, yyextra->linenum, yytext); } <END_OF_RECORD>{newline} { |