busybox: fix potential build-time buffer overflow

d8bcd48503 ("fortify-headers: 1.1 -> 3.0.1") (currently on staging)
breaks the musl build by identifying this issue.
This commit is contained in:
Alyssa Ross
2026-03-29 13:27:57 +02:00
parent 25ac73a57c
commit 4c3f8b7bb9
2 changed files with 29 additions and 0 deletions
@@ -0,0 +1,27 @@
From 3cf1ca7491bd5b6680e80355d76442ae14db681e Mon Sep 17 00:00:00 2001
From: Alyssa Ross <hi@alyssa.is>
Date: Sun, 29 Mar 2026 13:18:09 +0200
Subject: [PATCH] build system: fix potential buffer overflow
This could potentially write one byte past the end of line.
Identified by fortify-headers.
---
scripts/basic/split-include.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/basic/split-include.c b/scripts/basic/split-include.c
index 6ef29195e..93011d511 100644
--- a/scripts/basic/split-include.c
+++ b/scripts/basic/split-include.c
@@ -195,7 +195,7 @@ int main(int argc, const char * argv [])
ERROR_EXIT( "find" );
line[0] = '\n';
- while (fgets(line+1, buffer_size, fp_find))
+ while (fgets(line+1, buffer_size-1, fp_find))
{
if (strstr(list_target, line) == NULL)
{
--
2.53.0
@@ -90,6 +90,8 @@ stdenv.mkDerivation rec {
excludes = [ "networking/httpd_ratelimit_cgi.c" ]; # New since release.
hash = "sha256-Msm9sDZrVx7ofunnvnTS73SPKUUpR3Tv5xZ/wBd+rts=";
})
# https://lists.busybox.net/pipermail/busybox/2026-March/092010.html
./build-system-buffer-overflow.patch
]
++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) ./clang-cross.patch;