Wireshark-dev: Re: [Wireshark-dev] Unregistered header fields in packet-fcdns.c

From: Pascal Quantin <pascal@xxxxxxxxxxxxx>
Date: Tue, 10 Sep 2019 15:47:54 +0200
Hi Christian,

Le lun. 9 sept. 2019 à 23:46, Christian Svensson via Wireshark-dev <wireshark-dev@xxxxxxxxxxxxx> a écrit :
Hi,

I was doing an analysis of Fibre Channel frames when I started to see:
16:18:24.982          Warn Dissector bug, protocol FC-dNS, in packet 1403: epan/proto.c:5036: failed assertion "(guint)hfindex < gpa_hfinfo.len" (Unregistered hf!)
16:18:24.983          Warn Dissector bug, protocol FC-dNS, in packet 1421: epan/proto.c:5036: failed assertion "(guint)hfindex < gpa_hfinfo.len" (Unregistered hf!)
16:18:26.072          Warn Dissector bug, protocol FC-dNS, in packet 1403: epan/proto.c:5036: failed assertion "(guint)hfindex < gpa_hfinfo.len" (Unregistered hf!)
16:18:26.075          Warn Dissector bug, protocol FC-dNS, in packet 1421: epan/proto.c:5036: failed assertion "(guint)hfindex < gpa_hfinfo.len" (Unregistered hf!)
16:19:11.822          Warn Dissector bug, protocol FC-dNS, in packet 1403: epan/proto.c:5036: failed assertion "(guint)hfindex < gpa_hfinfo.len" (Unregistered hf!)
16:19:11.823          Warn Dissector bug, protocol FC-dNS, in packet 1421: epan/proto.c:5036: failed assertion "(guint)hfindex < gpa_hfinfo.len" (Unregistered hf!)
16:19:21.424          Warn Dissector bug, protocol FC-dNS, in packet 1403: epan/proto.c:5036: failed assertion "(guint)hfindex < gpa_hfinfo.len" (Unregistered hf!)
16:19:21.425          Warn Dissector bug, protocol FC-dNS, in packet 1421: epan/proto.c:5036: failed assertion "(guint)hfindex < gpa_hfinfo.len" (Unregistered hf!)
16:19:26.560          Warn Dissector bug, protocol FC-dNS, in packet 1403: epan/proto.c:5036: failed assertion "(guint)hfindex < gpa_hfinfo.len" (Unregistered hf!)
16:19:26.580          Warn Dissector bug, protocol FC-dNS, in packet 1421: epan/proto.c:5036: failed assertion "(guint)hfindex < gpa_hfinfo.len" (Unregistered hf!)

I looked at the packet-fcdns.c and it seems there are some hfis that are created but never registered. The following patch seems to make the error go away.

diff -ur t/wireshark-3.1.0/epan/dissectors/packet-fcdns.c wireshark-3.1.0/epan/dissectors/packet-fcdns.c
--- t/wireshark-3.1.0/epan/dissectors/packet-fcdns.c 2019-07-25 11:47:24.000000000 -0700
+++ wireshark-3.1.0/epan/dissectors/packet-fcdns.c 2019-09-07 16:33:43.029546894 -0700
@@ -2006,6 +2006,10 @@
         &hfi_fcdns_fc4features,
         &hfi_fcdns_fc4features_i,
         &hfi_fcdns_fc4features_t,
+        &hfi_fcdns_id_length,
+        &hfi_fcdns_num_entries,
+        &hfi_fcdns_zone_flags,
+        &hfi_fcdns_zonelen,
     };
 #endif
 
Currently I'm not in a position where I would like to learn another code review system, or I would have submitted it there. Fwiw, if you were using Github I would have sent a PR instead of this email, but it is what it is.

As can be seen, this is for wireshark-3.1.0.

Thanks for a great product,

Thanks for the report.
I double checked the file and confirmed that you found all the missing fields registration in the file (unfortunately this file uses the NEW_PROTO_TREE_API that is not compatible with the tools/checkhf.pl script, that's why it was not noticed earlier).
This will be fixed in the next Wireshark version (see https://code.wireshark.org/review/#/c/34492/ for the fix in master branch, I will backport it in other maintenance branches).

Best regards,
Pascal.