coreutils: fix heap buffer overflow

This was introduced when improving UBsan reports. Probably a new variety
of bugs to be classified in the same family as silencing compiler and
coverity warnings. https://marc.info/?l=oss-security&m=170556990821840&w=2

ok bcallah (maintainer)
This commit is contained in:
tb 2024-01-19 08:28:52 +00:00
parent 7343ca2fc5
commit 8f0af47b27
2 changed files with 20 additions and 0 deletions

View File

@ -2,6 +2,7 @@ COMMENT = file, shell and text manipulation utilities
DISTNAME = coreutils-9.4
CATEGORIES = sysutils
REVISION = 0
MAINTAINER = Brian Callahan <bcallah@openbsd.org>

View File

@ -0,0 +1,19 @@
Fix heap buffer overflow
https://github.com/coreutils/coreutils/commit/c4c5ed8f4e9cd55a12966d4f520e3a13101637d9
https://marc.info/?l=oss-security&m=170556990821840&w=2
Index: src/split.c
--- src/split.c.orig
+++ src/split.c
@@ -809,10 +809,7 @@ line_bytes_split (intmax_t n_bytes, char *buf, idx_t b
{
cwrite (n_out == 0, hold, n_hold);
n_out += n_hold;
- if (n_hold > bufsize)
- hold = xirealloc (hold, bufsize);
n_hold = 0;
- hold_size = bufsize;
}
/* Output to eol if present. */