Skip to content

Commit

Permalink
bugreport.c: replace strbuf_write_fd with write_in_full
Browse files Browse the repository at this point in the history
The strbuf_write_fd method did not provide checks for buffers larger
than MAX_IO_SIZE. Replacing with write_in_full ensures the entire
buffer will always be written to disk or report an error and die.

Signed-off-by: Randall S. Becker <rsbecker@nexbridge.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
rsbeckerca authored and gitster committed Jun 19, 2020
1 parent 01b62aa commit f64b6a1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bugreport.c
Expand Up @@ -122,7 +122,9 @@ int cmd_main(int argc, const char **argv)
die(_("couldn't create a new file at '%s'"), report_path.buf);
}

strbuf_write_fd(&buffer, report);
if (write_in_full(report, buffer.buf, buffer.len) < 0)
die_errno(_("unable to write to %s"), report_path.buf);

close(report);

/*
Expand Down

0 comments on commit f64b6a1

Please sign in to comment.