]> granicus.if.org Git - sudo/commitdiff
In io_callback() if we write the complete buffer and find that there
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 4 May 2016 18:53:20 +0000 (12:53 -0600)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 4 May 2016 18:53:20 +0000 (12:53 -0600)
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.

src/exec_pty.c

index 359dde255868da65a8c02e3e23cab0130a2a161b..6ae58717784d5c0685e67fff8b064dc8c55bbbdd 100644 (file)
@@ -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. */