diff --git a/plugins/sudoers/sudoreplay.c b/plugins/sudoers/sudoreplay.c index 91c64399ee..e3f71f042b 100644 --- a/plugins/sudoers/sudoreplay.c +++ b/plugins/sudoers/sudoreplay.c @@ -1162,6 +1162,17 @@ write_output(int fd, int what, void *v) } if (iobuf->off == iobuf->len) { + if (iobuf->toread != 0) { + /* + * Record is larger than the I/O buffer, reset the buffer and + * reschedule to write the rest of the record before advancing. + */ + iobuf->off = 0; + iobuf->len = 0; + if (sudo_ev_add(NULL, closure->output_ev, NULL, false) == -1) + sudo_fatal("%s", U_("unable to add event to queue")); + debug_return; + } /* Write complete, go to next timing entry if possible. */ switch (get_timing_record(closure)) { case 0: