[PATCH 2.39 v2 0/4] Backport %mc fixes to 2.39
Adarsh Jagadish Kamini
adarsh.jagadish.kamini@est.tech
Thu Jul 23 18:44:43 GMT 2026
v1 was just the %mc overflow fix (CVE-2026-5450). The review pointed out
it should go to 2.40 first, and that the fix isn't much use on its own:
%mc is still broken without the BZ #12701 work, and fixing 12701 outright
has backwards-compatibility problems.
So v2 adds 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. This matches what's on
2.41 and 2.42. The 2.40 backport has been posted separately.
Patch 2 (xfmemopen) is a prerequisite for the BZ #12701 tests; it didn't
exist on 2.39 yet.
Order:
1. %mc overflow fix (CVE-2026-5450)
2. xfmemopen test helper
3. allow partially-filled %mc buffers
4. reject insufficient character data
Changes since v1:
- add xfmemopen test helper (patch 2)
- add the two BZ #12701 fixes (patches 3 and 4)
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
More information about the Libc-alpha
mailing list