mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-17 18:02:09 +03:00
A single character --section-delimiter is completed with an implied ':' by writing through section_del, which is assumed to still point at the static DEFAULT_SECTION_DELIMITERS buffer. After an earlier -d with zero or more than one character, section_del points at that argument instead, so the write goes into the earlier argv string and past its end. In a UTF-8 locale 'nl -d "" FILE -d x' corrupts the FILE operand, and in the C locale 'nl -d foo -d x' uses the delimiter "xoo". * src/nl.c (main): Point section_del at the static buffer before building the single character delimiter. * tests/nl/nl.sh, tests/nl/multibyte.sh: Add test cases. * NEWS: Mention the bug fix. Bug present since coreutils 9.0. Link: https://github.com/coreutils/coreutils/pull/403