1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-01 03:22:48 -05:00

log_proxy_stderr: limit the length of Event Log lines.

If a proxy command jabbers on standard error in a way that doesn't
involve any newline characters, we now won't keep buffering data for
ever.

(Not that I've heard of it happening, but I noticed the theoretical
possibility on the way past in a recent cleanup pass.)
This commit is contained in:
Simon Tatham
2019-03-01 19:18:31 +00:00
parent 76bacaabf0
commit b9f20b84f3
4 changed files with 83 additions and 41 deletions

View File

@ -18,7 +18,7 @@ typedef struct FdSocket {
bufchain pending_output_data;
bufchain pending_input_data;
bufchain pending_input_error_data;
ProxyStderrBuf psb;
enum { EOF_NO, EOF_PENDING, EOF_SENT } outgoingeof;
int pending_error;
@ -300,7 +300,7 @@ static void fdsocket_select_result_input_error(int fd, int event)
retd = read(fd, buf, sizeof(buf));
if (retd > 0) {
log_proxy_stderr(fds->plug, &fds->pending_input_error_data, buf, retd);
log_proxy_stderr(fds->plug, &fds->psb, buf, retd);
} else {
del234(fdsocket_by_inerrfd, fds);
uxsel_del(fds->inerrfd);
@ -337,7 +337,7 @@ Socket *make_fd_socket(int infd, int outfd, int inerrfd, Plug *plug)
bufchain_init(&fds->pending_input_data);
bufchain_init(&fds->pending_output_data);
bufchain_init(&fds->pending_input_error_data);
psb_init(&fds->psb);
if (fds->outfd >= 0) {
if (!fdsocket_by_outfd)