Skip to content

Commit

Permalink
NFS: Fix string decoding to use UTF-8
Browse files Browse the repository at this point in the history
Use tvb_get_string_enc() to read a string.

I think NFSv3 doesn't specify an encoding so interoperabilty
is dicey. I believe NFSv4 specifies UTF-8.

Fixes #18628.
  • Loading branch information
randstr committed Nov 13, 2022
1 parent fd96d81 commit ae0c38a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions epan/dissectors/packet-nfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -8110,8 +8110,7 @@ dissect_nfs4_dirlist(tvbuff_t *tvb, int offset, packet_info *pinfo,
/*
* Get the entry name and create subtree of field nfs.name
*/
name = (char *)tvb_memcpy(tvb, wmem_alloc(wmem_packet_scope(), name_len+1), offset + 16, name_len);
name[name_len] = '\0';
name = tvb_get_string_enc(wmem_packet_scope(), tvb, offset + 16, name_len, ENC_UTF_8);

eitem = proto_tree_add_string_format(
dirlist_tree, hf_nfs_name, tvb, offset, -1, name, "Entry: %s", name);
Expand Down

0 comments on commit ae0c38a

Please sign in to comment.