aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-systemd-journal.c
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2018-09-27 16:31:52 -0700
committerGerald Combs <gerald@wireshark.org>2018-09-28 01:41:33 +0000
commitbeccf8f84e4a5edbb3b69f9e8777b72227795747 (patch)
tree7f865f951ea29ee075e6b10ac308ea75cfc3b4f7 /epan/dissectors/packet-systemd-journal.c
parent04ce1078e30785b6deeaa8376b0afdf9909c5b8d (diff)
systemd Journal: Handle empty lines.
Continue dissecting if we find an empty line. Add an entry for the _SYSTEMD_USER_SLICE field. Change-Id: Id6e970b785e359095fbd8101e071f2d8cabcaf53 Reviewed-on: https://code.wireshark.org/review/29897 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'epan/dissectors/packet-systemd-journal.c')
-rw-r--r--epan/dissectors/packet-systemd-journal.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/epan/dissectors/packet-systemd-journal.c b/epan/dissectors/packet-systemd-journal.c
index dff789d011..1c34e5ca61 100644
--- a/epan/dissectors/packet-systemd-journal.c
+++ b/epan/dissectors/packet-systemd-journal.c
@@ -140,6 +140,7 @@ static int hf_sj_leader = -1;
static int hf_sj_job_type = -1;
static int hf_sj_job_result = -1;
static int hf_sj_user_invocation_id = -1;
+static int hf_sj_systemd_user_slice = -1;
// Metadata.
static int hf_sj_binary_data_len = -1;
@@ -268,6 +269,7 @@ static void init_jf_to_hf_map(void) {
{ hf_sj_job_type, "JOB_TYPE" },
{ hf_sj_job_result, "JOB_RESULT" },
{ hf_sj_user_invocation_id, "USER_INVOCATION_ID" },
+ { hf_sj_systemd_user_slice, "_SYSTEMD_USER_SLICE=" },
{ 0, NULL }
};
jf_to_hf = (journal_field_hf_map*) g_memdup(jhmap, sizeof(jhmap));
@@ -303,7 +305,6 @@ dissect_systemd_journal_line_entry(tvbuff_t *tvb, packet_info *pinfo _U_, proto_
proto_item *ti;
proto_tree *sje_tree;
int offset = 0, next_offset = 0;
- int line_len;
col_set_str(pinfo->cinfo, COL_PROTOCOL, PSNAME);
col_clear(pinfo->cinfo, COL_INFO);
@@ -312,7 +313,14 @@ dissect_systemd_journal_line_entry(tvbuff_t *tvb, packet_info *pinfo _U_, proto_
ti = proto_tree_add_item(tree, proto_systemd_journal, tvb, 0, -1, ENC_NA);
sje_tree = proto_item_add_subtree(ti, ett_systemd_journal_entry);
- while ((line_len = tvb_find_line_end(tvb, offset, -1, &next_offset, FALSE)) >= 3) { // A=1
+ while (tvb_offset_exists(tvb, offset)) {
+ int line_len = tvb_find_line_end(tvb, offset, -1, &next_offset, FALSE);
+ if (line_len < 3) {
+ // Invalid or zero length.
+ // XXX Add an expert item for non-empty lines.
+ offset = next_offset;
+ continue;
+ }
gboolean found = FALSE;
int eq_off = tvb_find_guint8(tvb, offset, line_len, '=') + 1;
int val_len = offset + line_len - eq_off;
@@ -766,6 +774,10 @@ proto_register_systemd_journal(void)
{ "User invocation ID", "systemd_journal.user_invocation_id",
FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
},
+ { &hf_sj_systemd_user_slice,
+ { "Systemd user slice", "systemd_journal.systemd_user_slice",
+ FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
+ },
{ &hf_sj_binary_data_len,
{ "Binary data length", "systemd_journal.binary_data_len",