]> git.ipfire.org Git - thirdparty/git.git/commitdiff
bugreport.c: replace strbuf_write_fd with write_in_full
authorRandall S. Becker <randall.becker@nexbridge.ca>
Fri, 19 Jun 2020 20:23:19 +0000 (16:23 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 19 Jun 2020 20:50:25 +0000 (13:50 -0700)
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>
bugreport.c

index acacca8fef0f0c02581903693a947c04e97597c6..0cc71dcc6f24a7d671885da1eedb7fd245645525 100644 (file)
@@ -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);
 
        /*