appneta / tcpreplay

Pcap editing and replay tools for *NIX and Windows - Users please download source from
http://tcpreplay.appneta.com/wiki/installation.html#downloads
1.15k stars 268 forks source link

[Bug] Infinite loop in tcprewrite at get.c:569 #827

Closed TimChan2001 closed 1 month ago

TimChan2001 commented 9 months ago

Describe the bug Tcprewrite gets stuck in an infinite loop at the while loop at get.c:569.

To Reproduce Steps to reproduce the behavior:

  1. export CC=clang && export CFLAGS="-fsanitize=address -g"
  2. ./autogen.sh && ./configure --disable-shared --disable-local-libopts && make clean && make -j8
  3. ./src/tcprewrite -o /dev/null -i POC The POC file can be downloaded in POC

Expected behavior The program continues to run for over a week without termination.

image

System (please complete the following information):

Additional context After debugging with GDB and adding debug outputs, it seems the program is unable to exit the while loop at get.c:569.

GabrielGanne commented 5 months ago

Hi @TimChan2001 I have proposed a small fix for the issue you raised. I should have tested on the same env you described but got an different error with your pcap first:

Fatal Error: Unable to open input pcap file: unsupported pcap savefile version 60418.4

I had to rewrite it to first and then reproduced the issue. The fix seems straightforward enough, I expect it will work for you. BR,

fklassen commented 1 month ago

Not merged yet - reopening

fklassen commented 1 month ago

fixed in PRs #842 and #859