LightPcapNg
LightPcapNg copied to clipboard
Invalid section block size and interface block size
I am calling light_pcapng_open_write(file, light_create_default_file_info()) and light_pcapng_open_write is writing a section header that is 12 bytes too large and also appending 12 bytes too large interface description blocks. This file then fails to open in both light_pcapng_open_append and wireshark as they think that extra space is for options.
https://github.com/rvelea/LightPcapNg/blob/33296580096f83a9f17ebe7ea3d2c79977a24471/src/light_pcapng_ext.c#L215
https://github.com/rvelea/LightPcapNg/blob/33296580096f83a9f17ebe7ea3d2c79977a24471/src/light_pcapng_ext.c#L250
+3*sizeof(uint32_t)
is the extra incorrect values you are adding to the block size. light_alloc_block does the same inside for the block_total_length, which is correct, so i think you are just appending it twice for some reason? Removing the outside +3* solves it.
I can then open the written file with both light_pcapng_open_append and wireshark without errors. I suggest you check your tests too as such an obvious thing should not have been passing them?
Same problem in light_write_packet
Ran into the same problem here - switching back to commit bbde802 resolves the problem, the latest accepted pull request seemed to have broken it.