@matheusbsbs / matheus-bagliano / commits / f64b6a1f75
Fork 0

bugreport.c: replace strbuf_write_fd with write_in_full

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>

Randall S. Becker committed Jun 19, 2020 at 16:23 UTC f64b6a1f750e65ca90435f714d9350493aad836d
1 file changed +3 -1
bugreport.c
+3 -1
@@ -122,7 +122,9 @@ int cmd_main(int argc, const char **argv)
122 die(_("couldn't create a new file at '%s'"), report_path.buf);
123 }
124
125 - strbuf_write_fd(&buffer, report);
125 + if (write_in_full(report, buffer.buf, buffer.len) < 0)
126 + die_errno(_("unable to write to %s"), report_path.buf);
127 +
128 close(report);
129
130 /*