aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ntp.c
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2014-08-27 23:57:19 +0200
committerAlexis La Goutte <alexis.lagoutte@gmail.com>2014-08-28 07:14:55 +0000
commitedcd2dd57f1649dbb25f1ad0f4a3a77c4d454322 (patch)
treeb6167151b0e5fa0866c35590a9eb5d8ab55dfd6c /epan/dissectors/packet-ntp.c
parent14b0d710f500c45e023e8175876f88a6ecc1c539 (diff)
NTP: fix parsing of control assignments with empty value
Consider that ',' is a separator between assignments and make value presence optional Bug: 10417 Change-Id: I23f2b4029548a1263d65ee11c6356270e7a89bd7 Reviewed-on: https://code.wireshark.org/review/3884 Reviewed-by: Evan Huus <eapache@gmail.com> Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-ntp.c')
-rw-r--r--epan/dissectors/packet-ntp.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/epan/dissectors/packet-ntp.c b/epan/dissectors/packet-ntp.c
index 1632c903ea..f3fbe8f048 100644
--- a/epan/dissectors/packet-ntp.c
+++ b/epan/dissectors/packet-ntp.c
@@ -1261,22 +1261,25 @@ init_parser(void)
tvbparse_wanted_t *want_identifier = tvbparse_chars(-1, 1, 0,
"abcdefghijklmnopqrstuvwxyz-_ABCDEFGHIJKLMNOPQRSTUVWXYZ.0123456789", NULL, NULL, NULL);
/* this is the equal sign used in assignments */
- tvbparse_wanted_t *want_equalsign = tvbparse_chars(-1, 1, 0, "=", NULL, NULL, NULL);
+ tvbparse_wanted_t *want_equalsign = tvbparse_char(-1, "=", NULL, NULL, NULL);
/* possible characters allowed for values */
tvbparse_wanted_t *want_value = tvbparse_set_oneof(0, NULL, NULL, NULL,
tvbparse_quoted(-1, NULL, NULL, tvbparse_shrink_token_cb, '\"', '\\'),
tvbparse_quoted(-1, NULL, NULL, tvbparse_shrink_token_cb, '\'', '\\'),
tvbparse_chars(-1, 1, 0, "abcdefghijklmnopqrstuvwxyz-_ABCDEFGHIJKLMNOPQRSTUVWXYZ.0123456789 ", NULL, NULL, NULL),
NULL);
+ tvbparse_wanted_t *want_comma = tvbparse_until(-1, NULL, NULL, NULL,
+ tvbparse_char(-1, ",", NULL, NULL, NULL), TP_UNTIL_SPEND);
/* the following specifies an assignment of the form identifier=value */
tvbparse_wanted_t *want_assignment = tvbparse_set_seq(-1, NULL, NULL, NULL,
want_identifier,
want_equalsign,
- want_value,
+ tvbparse_some(-1, 0, 1, NULL, NULL, NULL, want_value),
+ tvbparse_some(-1, 0, 1, NULL, NULL, NULL, want_comma),
NULL);
/* we ignore white space characters */
- want_ignore = tvbparse_chars(-1, 1, 0, ", \t\r\n", NULL, NULL, NULL);
+ want_ignore = tvbparse_chars(-1, 1, 0, " \t\r\n", NULL, NULL, NULL);
/* data part of control messages consists of either identifiers or assignments */
want = tvbparse_set_oneof(-1, NULL, NULL, NULL,
want_assignment,