Wireshark:a. Open a file with ERF encapsulation;b. "Save As" selected packets (not the whole file since that will just copy the file);The output file format will be invalid. ("file has ... packet, bigger than maximum of 65535").Using editcap with an input ERF encapsulated file will also produce a bad output file.(I'm assuming that this happens on all OS's although I've only tried Windows).(This is the cause of Bug #3569).I'll have a look-see at the code....
I'm going to leave this to someone who is familiar with ERF encapsulation.I've attached the ERF encapsulated file which was the original capture file used to generate the fuzzed file in Bug #3569.Re:> a. Open a file with ERF encapsulation; Actually: I don't know if there's something about this particular file causing a problem or whether the problem will occur with any ERF encapsulated file.
I think the problem here is that pcap_write_phdr() doesn't write out the erf extension headers. But even if they were written, these erf-encapsulated packets have more than 8 extension headers; however, the pseudo header seems to limit the number to 8, so the resulting file would have truncated the extension headers anyway, which isn't what you want.
To resolve these problems, I think it would be better to just eliminate the erf pseudo-header altogether and simply read in all the packet bytes and let the packet-erf dissector process the bytes as appropriate. Writing selected packets out to another file is then trivial. This is essentially what I've done recently for the USB pseudo header, and I think it works a lot better.
For example, the USB URB bytes are now highlighted when a field is selected whereas previously those bytes only resided in the pseudo-header and so couldn't be highlighted. Looking at the erf header, you don't see what bytes are associated with which header fields because they don't actually exist in the tvb but rather they're only in the pseudo header.
(See bug #4664 for more details on the USB changes that were made.)