HomeFreeBSD

indent: Fix buffer overflow

Description

indent: Fix buffer overflow

The function used to create a backup of the input before starting work
used a static buffer and did not check that the file name it constructed
did not overflow. Switch to using asprintf(), clean up the rest of the
function, and update some comments that still referred to an earlier
version of the code.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: bnovkov
Differential Revision: https://reviews.freebsd.org/D51796

(cherry picked from commit eb41613d22977798f41dd979e4e4ec0965711916)

Details

Provenance
desAuthored on Aug 7 2025, 11:34 PM
Reviewer
bnovkov
Differential Revision
D51796: indent: Fix buffer overflow
Parents
rG831799f6d3a9: indent: Simplify test script
Branches
Unknown
Tags
Unknown