diff options
author | Guillaume Nault <g.nault@alphalink.fr> | 2016-04-27 21:02:37 +0200 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2016-04-28 11:16:05 +0300 |
commit | 16449c4f4972ffad500951db5c71403cae0422e7 (patch) | |
tree | a7987a14e41bd5cceac9e82a7fa990b31015e257 /accel-pppd/cli/telnet.c | |
parent | 7de0d2d00be552dede15dfd02c9e423dda7eb6f5 (diff) | |
download | accel-ppp-16449c4f4972ffad500951db5c71403cae0422e7.tar.gz accel-ppp-16449c4f4972ffad500951db5c71403cae0422e7.zip |
cli: fix partial line duplication and truncation
When queueing output data for later write(), the 'n' first bytes of the
buffer have already been sent (we have n > 0 if EAGAIN was returned
after some other write() calls succeeded). Therefore, we need to skip
these bytes when initialising the buffer to be queued.
The size passed to memcpy() did already take that space into account.
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Diffstat (limited to 'accel-pppd/cli/telnet.c')
-rw-r--r-- | accel-pppd/cli/telnet.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/accel-pppd/cli/telnet.c b/accel-pppd/cli/telnet.c index de2f39ff..b8ca8231 100644 --- a/accel-pppd/cli/telnet.c +++ b/accel-pppd/cli/telnet.c @@ -157,7 +157,7 @@ static int telnet_send(struct telnet_client_t *cln, const void *_buf, int size) if (errno == EAGAIN) { b = _malloc(sizeof(*b) + size - n); b->size = size - n; - memcpy(b->buf, buf, size - n); + memcpy(b->buf, buf + n, size - n); queue_buffer(cln, b); triton_md_enable_handler(&cln->hnd, MD_MODE_WRITE); |