Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data corruption due to packets with padding (1.6.1) #261

Closed
Dimon160 opened this issue Jun 10, 2024 · 4 comments · Fixed by #262
Closed

Data corruption due to packets with padding (1.6.1) #261

Dimon160 opened this issue Jun 10, 2024 · 4 comments · Fixed by #262

Comments

@Dimon160
Copy link

Short TCP4 packets with Ethernet padding and no stream data (window manipulation, etc.) may corrupt output files, because of incorrect length using.
Also, tcpflow creates 2-3 unwanted files, contain only two zero bytes.
In my case, I get regular one corrupted byte, every ~350Mbytes.

Attached patch fix both problems.

patch-tcpdemux-cpp.txt

@simsong
Copy link
Owner

simsong commented Jun 10, 2024

That is great! Can you please submit this as a pull request? Even better, do you have a PCAP file that demonstrates this problem? If so, please submit that too, so that we can add a unit test for it.

@Dimon160
Copy link
Author

Thanks for your quick response!
I'm sorry, I not fully understand how to do pull request and short unit test.

I'm upload archive (~800Mbytes) contain PCAP file, that demonstrates the problem.
https://easyupload.io/5c26a9 (stored for 30 days)
With a patch, stream restored correctly,
MD5: 3f19c1510bf5ac6f8874ae34c6ec1966
Without a patch, restored stream is corrupted,
MD5: ffc7a3711353aa5929be6b2f6456e7c1
Different bytes is:
153850CF: 9C 00
2A6FCE9B: DD 00
Original file from stream, can be downloaded from:
ftp://ftp.freebsd.org/pub/FreeBSD/releases/ISO-IMAGES/13.3/FreeBSD-13.3-RELEASE-amd64-memstick.img.xz
MD5: 3f19c1510bf5ac6f8874ae34c6ec1966

@simsong
Copy link
Owner

simsong commented Jun 10, 2024

I can make a pull request. Can you make a smaller PCAP file? Ideally 10-100kb?

@Dimon160
Copy link
Author

It seems to do it.
Following archive, contain very small PCAP file, that demonstrates two stream decoding errors, and one unwanted file.
Maybe it's similar to #253 and #258 issues.

pcap.zip

simsong added a commit that referenced this issue Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants