[PATCH 2.40 0/4] Backport %mc fixes to 2.40

Adarsh Jagadish Kamini <[email protected]>
Newsgroups gmane.comp.lib.glibc.alpha
Message-ID <[email protected]>
This backports the scanf %mc fixes to 2.40, which was still missing
them. It matches what's already on 2.41 and 2.42.

Patch 1 is the CVE-2026-5450 fix for the one-byte overflow in the
%mc/%mC buffer allocation. On its own that isn't much use, since %mc
is still broken without the BZ #12701 work, and fixing 12701 outright
has backwards-compatibility problems. So this also pulls in DJ's
backwards-compatible variant that expands and NUL-pads the buffer while
still allowing truncated reads, plus the matching "reject insufficient
character data" change.

Patch 2 (xfmemopen) is a prerequisite for the BZ #12701 tests; it
didn't exist on 2.40 yet.

Order:

  1. %mc overflow fix (CVE-2026-5450)
  2. xfmemopen test helper
  3. allow partially-filled %mc buffers
  4. reject insufficient character data

Tested on x86_64. tst-vfscanf-bz34008, tst-bz12701-c, tst-bz12701-c2,
tst-bz12701-lc and tst-bz12701-lc2 all pass.

DJ Delorie (1):
  stdio-common: Allow partially-filled %mc buffers [BZ #12701]

Maciej W. Rozycki (2):
  support: Implement 'xfmemopen' for seamless 'fmemopen' use
  stdio-common: Reject insufficient character data in scanf [BZ #12701]

Rocket Ma (1):
  stdio-common: Fix buffer overflow in scanf %mc [BZ #34008]

 localedata/Makefile                |   2 +
 localedata/tst-bz12701-lc.c        | 218 +++++++++++++++++++++++++++++
 localedata/tst-bz12701-lc2.c       |  47 +++++++
 stdio-common/Makefile              |   6 +
 stdio-common/tst-bz12701-c.c       | 169 ++++++++++++++++++++++
 stdio-common/tst-bz12701-c2.c      |  46 ++++++
 stdio-common/tst-vfscanf-bz34008.c |  48 +++++++
 stdio-common/vfscanf-internal.c    |  23 ++-
 support/Makefile                   |   1 +
 support/xfmemopen.c                |  31 ++++
 support/xstdio.h                   |   1 +
 11 files changed, 585 insertions(+), 7 deletions(-)
 create mode 100644 localedata/tst-bz12701-lc.c
 create mode 100644 localedata/tst-bz12701-lc2.c
 create mode 100644 stdio-common/tst-bz12701-c.c
 create mode 100644 stdio-common/tst-bz12701-c2.c
 create mode 100644 stdio-common/tst-vfscanf-bz34008.c
 create mode 100644 support/xfmemopen.c

-- 
2.34.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.