Skip to content

Commit 9efa30c

Browse files
committed
transport-helper: check dup() return in get_exporter
get_exporter() duplicates helper->in via dup() and stores the result in fastexport->out. If dup() fails (fd exhaustion), it returns -1. The child_process machinery interprets out = -1 as "create a pipe for stdout", which would silently change the fast-export process's output wiring: instead of sending data back through the helper's input fd, it would write to a new pipe that nobody reads from. Check the return value and report the error before proceeding. Pointed out by Coverity. Assisted-by: Claude Opus 4.6 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent c150d2a commit 9efa30c

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

transport-helper.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,8 @@ static int get_exporter(struct transport *transport,
489489
/* we need to duplicate helper->in because we want to use it after
490490
* fastexport is done with it. */
491491
fastexport->out = dup(helper->in);
492+
if (fastexport->out < 0)
493+
return error_errno(_("could not dup helper output fd"));
492494
strvec_push(&fastexport->args, "fast-export");
493495
strvec_push(&fastexport->args, "--use-done-feature");
494496
strvec_push(&fastexport->args, data->signed_tags ?

0 commit comments

Comments
 (0)