diff options
| author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2026-07-10 11:39:29 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-07-10 08:13:54 -0700 |
| commit | 775f1f2b19e1c3d133356170373fedeb363988a3 (patch) | |
| tree | 1f82be09c870948e0e8fd17254c96b4820bea5be /git-commit-script | |
| parent | d321f42c09b4f01978592cb2a4b8dc5fd86a5e12 (diff) | |
mailsplit: move NULL check before first use of file handle
The `split_mbox()` function calls fileno(f) to check whether the input
is a terminal, but the NULL check for f (from `fopen()`) does not happen
until later. When the file cannot be opened, f is NULL, and
`fileno(NULL)` is undefined behavior, typically crashing with a
segmentation fault.
Move the NULL check above the `isatty()`/`fileno()` call so the error
path is taken before any use of the potentially-NULL handle.
Pointed out by Coverity.
Assisted-by: Claude Opus 4.6
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-commit-script')
0 files changed, 0 insertions, 0 deletions
