From: Todd C. Miller Date: Wed, 4 May 2016 18:53:20 +0000 (-0600) Subject: In io_callback() if we write the complete buffer and find that there X-Git-Tag: SUDO_1_8_17^2~122 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4ce39df38f79e5c078d95d46d71d8135bf713c17;p=sudo In io_callback() if we write the complete buffer and find that there is no associated reader just return as there is nothing else to be done. In practice is it not possible for SUDO_EV_READ to be set if revent is NULL but an early return is harmless and possibly easier to understand. Coverity CID 104124. --- diff --git a/src/exec_pty.c b/src/exec_pty.c index 359dde255..6ae587177 100644 --- a/src/exec_pty.c +++ b/src/exec_pty.c @@ -592,10 +592,11 @@ io_callback(int fd, int what, void *v) /* Reset buffer if fully consumed. */ if (iob->off == iob->len) { iob->off = iob->len = 0; - /* Forward the EOF from reader to writer. */ + /* If reader is gone, close and remove writer; we are done. */ if (iob->revent == NULL) { safe_close(fd); ev_free_by_fd(evbase, fd); + debug_return; } } /* Re-enable writer if buffer is not empty. */