The bug was that genname( ) used a static namebuf buffer and did not properly check for overflow when writing into it. The result was that the non_corr variable was sometimes overwritten with a non-zero value when it should be zero, causing bogus results later.
This proposed patch makes genname( ) dynamically allocate and resize a buffer for holding a target file name.
I also take this chance to fix a typo in correct_prefix().
This should fix at least some instances of the undefined reference to `LLnc_recover' error that happens in some builds (https://github.com/davidgiven/ack/issues/218).
The bug was that
genname( )
used a staticnamebuf
buffer and did not properly check for overflow when writing into it. The result was that thenon_corr
variable was sometimes overwritten with a non-zero value when it should be zero, causing bogus results later.This proposed patch makes
genname( )
dynamically allocate and resize a buffer for holding a target file name.I also take this chance to fix a typo in
correct_prefix()
.