]> git.ipfire.org Git - thirdparty/coreutils.git/commit
fold: fix out of bounds write with zero width characters
authorCollin Funk <collin.funk1@gmail.com>
Tue, 16 Sep 2025 03:53:23 +0000 (20:53 -0700)
committerCollin Funk <collin.funk1@gmail.com>
Tue, 16 Sep 2025 03:55:56 +0000 (20:55 -0700)
commit98e5418a38fa8e944d5b694ba2aa0c165092e63b
tree8f0d2a184ec02ccee303cf0c3b2baef78790808b
parent8339970b155d6d3ed5623325bb577b29b59948d6
fold: fix out of bounds write with zero width characters

* src/fold.c (fold_file): Prefer putchar ('\n') to copying characters.
If we do not have room in the output buffer print it since it is not a
full line of text.
* tests/fold/fold-zero-width.sh: New test case.
* tests/local.mk (all_tests): Add it.
src/fold.c
tests/fold/fold-zero-width.sh [new file with mode: 0755]
tests/local.mk