Skip to content

Commit d27aa27

Browse files
authored
Wireshark crash fixes for 4.4 (#189)
Fix a crash when fetching `ssh.direction` caused by using the wrong function in #128. `fvalue_get_uinteger()` doesn't support the `FT_BOOLEAN` field, but `fvalue_get_uinteger64()` does. Fix a crash in `locate_tree()` when the first child of the passed-in tree is non-null but has a null `finfo` member. These fixes allow the plugin to pass the test suite on the current main branch (`master`) of Wireshark when built as an in-tree plugin.
1 parent 40a91c8 commit d27aa27

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

wireshark/source/packet-ja4.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ gint sort_by_string(gconstpointer s1, gconstpointer s2) {
281281
// Fix #63
282282
proto_tree *locate_tree(proto_tree *tree, const char *s) {
283283
proto_tree *position = tree->first_child;
284-
while ((position != NULL) && (strcmp(position->finfo->hfinfo->abbrev, s) != 0)) {
284+
while ((position != NULL) && (position->finfo != NULL) && (strcmp(position->finfo->hfinfo->abbrev, s) != 0)) {
285285
position = position->next;
286286
}
287287
return position;
@@ -1226,8 +1226,8 @@ dissect_ja4(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *dummy
12261226
conn_info_t *conn = conn_lookup(ja4_data.proto, stream);
12271227
conn->pkts++;
12281228

1229-
fvalue_get_uinteger(get_value_ptr(field)) ? conn->server_pkts++ : conn->client_pkts++;
1230-
fvalue_get_uinteger(get_value_ptr(field)) ?
1229+
fvalue_get_uinteger64(get_value_ptr(field)) ? conn->server_pkts++ : conn->client_pkts++;
1230+
fvalue_get_uinteger64(get_value_ptr(field)) ?
12311231
update_mode(tcp_len, conn->server_mode) :
12321232
update_mode(tcp_len, conn->client_mode);
12331233

0 commit comments

Comments
 (0)