#1150954 pftools: Fix heap buffer overflow in PrintTSV

Package:
src:pftools
Source:
src:pftools
Submitter:
Sebastien Bacher
Date:
2026-10-15 07:13:03 UTC
Severity:
normal
Tags:
#1150954#5
Date:
2026-10-15 07:11:16 UTC
From:
To:
Hi,

pfsearchV3 has a one-byte heap overflow in PrintTSV() (src/C/utils/output.c):

  char * ac  = calloc(strlen(prf->AC_Number),sizeof(char));
  strcpy(ac,prf->AC_Number);

The buffer has no room for the ending NUL (the other output functions
in the same file use 1+strlen()). It's visible with -D_FORTIFY_SOURCE=3,
which Ubuntu uses by default: the TSV output test aborts with
"*** buffer overflow detected ***" and the build fails.

The attached patch fixes it; with it all 6 tests pass. It's still present
in upstream master (v3.2.13).

Ubuntu bug: https://bugs.launchpad.net/bugs/2170856

Thanks,
Sebastien Bacher