Skip to content

Commit f64b6a1

Browse files
rsbeckercagitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 01b62aa commit f64b6a1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

bugreport.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ int cmd_main(int argc, const char **argv)
122122
die(_("couldn't create a new file at '%s'"), report_path.buf);
123123
}
124124

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+
126128
close(report);
127129

128130
/*

0 commit comments

Comments
 (0)