aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
diff options
context:
space:
mode:
authorJohn Thacker <johnthacker@gmail.com>2022-01-12 23:42:13 -0500
committerA Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2022-01-14 03:07:05 +0000
commit203820f3d02dbc4ea6fbd64b35700fc510e29684 (patch)
tree5082b3a5c8da7cd8e47d84332526e9ca7cd9b63a /wiretap
parent7da31cb1398041d9a71467eab82c9db2935f3c4c (diff)
wiretap: Register a systemd Journal Export Block
The block is lightweight and doesn't have any options so the create function doesn't really do anything, but it needs to be registered so that when systemd journal files are opened, the wtap_block_create() call works and doesn't segfault. Fix #17875
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/wtap_opttypes.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/wiretap/wtap_opttypes.c b/wiretap/wtap_opttypes.c
index dda5475003..86afcdc02e 100644
--- a/wiretap/wtap_opttypes.c
+++ b/wiretap/wtap_opttypes.c
@@ -1623,6 +1623,12 @@ static void pkt_create(wtap_block_t block)
block->mandatory_data = NULL;
}
+static void sjeb_create(wtap_block_t block)
+{
+ /* Ensure this is null, so when g_free is called on it, it simply returns */
+ block->mandatory_data = NULL;
+}
+
static void cb_create(wtap_block_t block)
{
/* Ensure this is null, so when g_free is called on it, it simply returns */
@@ -1853,6 +1859,16 @@ void wtap_opttypes_initialize(void)
WTAP_OPTTYPE_FLAG_MULTIPLE_ALLOWED
};
+ static wtap_blocktype_t journal_block = {
+ WTAP_BLOCK_SYSTEMD_JOURNAL_EXPORT, /* block_type */
+ "SJEB", /* name */
+ "systemd Journal Export Block", /* description */
+ sjeb_create, /* create */
+ NULL, /* free_mand */
+ NULL, /* copy_mand */
+ NULL /* options */
+ };
+
static wtap_blocktype_t cb_block = {
WTAP_BLOCK_CUSTOM, /* block_type */
"CB", /* name */
@@ -1924,6 +1940,11 @@ void wtap_opttypes_initialize(void)
wtap_opttype_option_register(&pkt_block, OPT_PKT_VERDICT, &pkt_verdict);
/*
+ * Register the SJEB and the (no) options that can appear in it.
+ */
+ wtap_opttype_block_register(&journal_block);
+
+ /*
* Register the CB and the options that can appear in it.
*/
wtap_opttype_block_register(&cb_block);