🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.bugs.dist
Article #1745

Bug#1151716: pkgdetails: FIELD mode prints uninitialized memory for missing checksum field

#1745
From: Mikie
Date: Fri, 23 Oct 2026 11:00
88 lines
5552 bytes
Package: base-installer
Severity: important
Tags: patch

Dear Maintainer,

pkgdetails's dopkgmirrorpkgs() in pkgdetails.c never initializes cur_size or cur_checksum, and never resets them between stanzas. Until now every Packages stanza carried MD5sum and Size, so both were always assigned before use. debootstrap 1.0.145 ("Use SHA512 if listed in Release file", uploaded 2026-08-31) added checksum algorithm negotiation by exporting DEBOOTSTRAP_CHECKSUM_FIELD, which makes the selected field a value a stanza may legitimately lack.

When the selected field is absent from a stanza, pkgdetails prints the uninitialized cur_checksum buffer in the checksum column of its FIELD output. In my case it emitted a single garbage byte, which defeats debootstrap's [ -z "$expchecksum" ] skip-comparison check, so every package fails checksum validation. The result is that "Install the base system" fails (base-installer/debootstrap-failed) after 10 acquisition retries per package, on perfectly good media. Stanzas missing only one of Size/checksum also silently inherit the previous stanza's value.

Observed in the wild: offline installer ISOs built with kalilinux/build-scripts/kali-installer, which pull debootstrap-udeb 1.0.145 from the current kali-rolling mirror, fail at "Install the base system" with every package reported corrupt. The trigger chain is Debian tooling throughout: debian-cd's make_disc_trees.pl emits a SHA512 section into the Release file unconditionally, while the Packages stanzas copied from the mirror only carry MD5sum/Size/SHA256; debootstrap 1.0.145 then negotiates SHA512; pkgdetails never sees a SHA512: line and prints uninitialized stack memory. The official Kali 2026.3 installer ISO carries the same Release/stanza skew but ships debootstrap 1.0.144 (no negotiation logic) and installs cleanly.

I have not verified whether Debian's own installer media is currently affected; that depends on whether current Debian Packages stanzas carry SHA512 fields. If they do not, any d-i image pairing the current mirror with debootstrap >= 1.0.145 would hit the same failure.

Standalone reproducer (no installer environment needed):

  cc -O2 -o pkgdetails pkgdetails.c

  DEBOOTSTRAP_CHECKSUM_FIELD=SHA512 ./pkgdetails FIELD 'Package:' \
      cdrom/ Packages gcc-16-base
  # checksum column contains uninitialized stack bytes

  DEBOOTSTRAP_CHECKSUM_FIELD=SHA256 ./pkgdetails FIELD 'Package:' \
      cdrom/ Packages gcc-16-base
  # checksum column contains the correct hash

Fix: initialize cur_size/cur_checksum alongside the other per-stanza
buffers and clear them on each Package: line, so a missing field yields
an empty output column, which debootstrap already treats as "field
not present". Patch:

--- begin patch ---
--- pkgdetails.c	2026-10-23 06:18:17.441891065 -0400
+++ pkgdetails_fix.c	2026-10-23 06:19:09.163481475 -0400
@@ -143,7 +143,8 @@
     char *output = NULL;
     int output_pkg = -1;
 
-    cur_field[0] = cur_pkg[0] = cur_ver[0] = cur_arch[0] = cur_filename[0] = prev_pkg[0] = '\0';
+    cur_field[0] = cur_pkg[0] = cur_ver[0] = cur_arch[0] = cur_size[0] =
+    cur_checksum[0] = cur_filename[0] = prev_pkg[0] = '\0';
 
     for (i = 0; i < pkgc; i++) pkgs[i] = in_pkgs[i];
 
@@ -159,6 +160,7 @@
 	}
         if (strncasecmp(buf, "Package:", 8) == 0) {
             fieldcpy(cur_pkg, buf);
+            cur_size[0] = cur_checksum[0] = '\0';
             if (strcmp(cur_pkg, prev_pkg) != 0) {
                 if (output)
                     fputs(output, stdout);
--- end patch ---


Happy to open a Salsa MR against installer-team/base-installer if preferred.

--
Mikie
mikie.yo@pm.me
Technical Details
Message-ID: <NRla9-7nwJ-3@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod
From: Mikie <mikie.yo@pm.me>
Newsgroups: linux.debian.bugs.dist,linux.debian.maint.boot
Subject: Bug#1151716: pkgdetails: FIELD mode prints uninitialized memory for missing checksum field
Date: Fri, 23 Oct 2026 13:00:01 +0200
Message-ID: <NRla9-7nwJ-3@gated-at.bofh.it>
X-Original-To: "submit@bugs.debian.org" <submit@bugs.debian.org>
X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org  Fri Oct 23 10:53:12 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: -1.45
Reply-To: Mikie <mikie.yo@pm.me>, 1151716@bugs.debian.org
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: debian-boot@lists.debian.org
X-Debian-Pr-Message: report 1151716
X-Debian-Pr-Package: base-installer
X-Debian-Pr-Keywords: patch
X-Debian-Pr-Source: base-installer
Feedback-ID: 124327122:user:proton
X-Pm-Message-ID: 317cd8aadabc5c7377de63a5e9572d98519ff61c
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Debian-Message: from BTS
X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/1998262
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 88
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Date: Fri, 23 Oct 2026 10:44:01 +0000
X-Original-Message-ID: <yja5qqYPDmnpT1WPtGgwbq7QAcxp-UQpznHcs_1ddLJKjYQGOOCurqs4zuQwP-FG_DvySVANs_wez9YSCchptr1rNdG2NbkpN3Toalp8pmo=@pm.me>