Article View: linux.debian.bugs.dist
Article #922Bug#1150954: pftools: Fix heap buffer overflow in PrintTSV
From: Sebastien Bacher
Date: Thu, 15 Oct 2026 07:20
Date: Thu, 15 Oct 2026 07:20
81 lines
4581 bytes
4581 bytes
This is a multi-part MIME message sent by reportbug.
--===============6033513397474231739==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Source: pftools
Version: 3.2.12-3ubuntu1
Severity: normal
Tags: patch
X-Debbugs-Cc: seb128@ubuntu.com
User: ubuntu-devel@lists.ubuntu.com
Usertags: origin-ubuntu stonking ubuntu-patch
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
-- System Information:
Debian Release: forky/sid
APT prefers resolute-updates
APT policy: (500, 'resolute-updates'), (500, 'resolute-security'), (500, 'resolute'), (100, 'resolute-backports')
Architecture: amd64 (x86_64)
Kernel: Linux 7.0.0-38-generic (SMP w/16 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_WARN, TAINT_OOT_MODULE
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
--===============6033513397474231739==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="fix-tsv-ac-overflow.patch"
Description: Fix heap buffer overflow in PrintTSV
The buffer for the accession number is allocated without room for the
ending NUL, so the following strcpy() writes one byte past the end.
With _FORTIFY_SOURCE=3 this aborts pfsearchV3 -o 7 (TSV output).
The other output functions already allocate 1+strlen().
Author: Sebastien Bacher <seb128@ubuntu.com>
Bug-Ubuntu: https://bugs.launchpad.net/bugs/2170856
Forwarded: https://github.com/sib-swiss/pftools3/pull/33
Last-Update: 2026-10-15
Index: pftools-3.2.12/src/C/utils/output.c
===================================================================
--- pftools-3.2.12.orig/src/C/utils/output.c
+++ pftools-3.2.12/src/C/utils/output.c
@@ -64,7 +64,7 @@ void PrintTSV(const struct Profile * con
while ( *cptr != ';' && *cptr != '\0') ++cptr;
*cptr = '\0';
- char * ac = calloc(strlen(prf->AC_Number),sizeof(char));
+ char * ac = calloc(1+strlen(prf->AC_Number),sizeof(char));
strcpy(ac,prf->AC_Number);
cptr = ac;
while ( *cptr != ';' && *cptr != '\0' ) ++cptr;
--===============6033513397474231739==--
Technical Details
Message-ID:
<NOnUR-5DFM-3@gated-at.bofh.it>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!3.eu.feeder.erje.net!feeder.erje.net!news.szaf.org!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomodShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!3.eu.feeder.erje.net!feeder.erje.net!news.szaf.org!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod From: Sebastien Bacher <seb128@ubuntu.com> Newsgroups: linux.debian.bugs.dist Subject: Bug#1150954: pftools: Fix heap buffer overflow in PrintTSV Date: Thu, 15 Oct 2026 09:20:01 +0200 Message-ID: <NOnUR-5DFM-3@gated-at.bofh.it> X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org Thu Oct 15 07:13:09 2026 Old-Return-Path: <debbugs@buxtehude.debian.org> X-Spam-Flag: NO X-Spam-Score: -1.651 Reply-To: Sebastien Bacher <seb128@ubuntu.com>, 1150954@bugs.debian.org Resent-To: debian-bugs-dist@lists.debian.org Resent-Cc: seb128@ubuntu.com, debian-med-packaging@lists.alioth.debian.org X-Debian-Pr-Message: report 1150954 X-Debian-Pr-Package: src:pftools X-Debian-Pr-Keywords: patch X-Debian-Pr-Source: pftools Content-Type: multipart/mixed; boundary="===============6033513397474231739==" MIME-Version: 1.0 X-Mailer: reportbug 13.2.0+ubuntu1 X-Debian-Message: from BTS X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/1996876 List-ID: <debian-bugs-dist.lists.debian.org> List-URL: <https://lists.debian.org/debian-bugs-dist/> Approved: robomod@news.nic.it Lines: 81 Organization: linux.* mail to news gateway Sender: robomod@news.nic.it X-Original-Date: Thu, 15 Oct 2026 09:11:16 +0200 X-Original-Message-ID: <179204827679.522949.12902112343319077289.reportbug@seb128-ThinkPad-T16>