summaryrefslogtreecommitdiff
path: root/accel-pppd
diff options
context:
space:
mode:
authorKozlov Dmitry <xeb@mail.ru>2012-11-27 11:27:47 +0400
committerKozlov Dmitry <xeb@mail.ru>2012-11-27 11:27:47 +0400
commit1289fd4fca1b6900295da524d078a594869d84e6 (patch)
tree591187f52b092a48dde1a616abf2a3176adba15c /accel-pppd
parent310c21779c06f69bf83e006c4f568f2f24fac1eb (diff)
downloadaccel-ppp-xebd-1289fd4fca1b6900295da524d078a594869d84e6.tar.gz
accel-ppp-xebd-1289fd4fca1b6900295da524d078a594869d84e6.zip
cli: check xmit_buf is not null at enter to write function
Diffstat (limited to 'accel-pppd')
-rw-r--r--accel-pppd/cli/tcp.c3
-rw-r--r--accel-pppd/cli/telnet.c5
2 files changed, 7 insertions, 1 deletions
diff --git a/accel-pppd/cli/tcp.c b/accel-pppd/cli/tcp.c
index b2ed910..da28ff7 100644
--- a/accel-pppd/cli/tcp.c
+++ b/accel-pppd/cli/tcp.c
@@ -192,6 +192,9 @@ static int cln_write(struct triton_md_handler_t *h)
struct tcp_client_t *cln = container_of(h, typeof(*cln), hnd);
int k;
+ if (!cln->xmit_buf)
+ return 0;
+
while (1) {
for (; cln->xmit_pos < cln->xmit_buf->size; cln->xmit_pos += k) {
k = write(cln->hnd.fd, cln->xmit_buf->buf + cln->xmit_pos, cln->xmit_buf->size - cln->xmit_pos);
diff --git a/accel-pppd/cli/telnet.c b/accel-pppd/cli/telnet.c
index 7409767..4635cab 100644
--- a/accel-pppd/cli/telnet.c
+++ b/accel-pppd/cli/telnet.c
@@ -501,7 +501,10 @@ static int cln_write(struct triton_md_handler_t *h)
{
struct telnet_client_t *cln = container_of(h, typeof(*cln), hnd);
int k;
-
+
+ if (!cln->xmit_buf)
+ return 0;
+
while (1) {
for (; cln->xmit_pos < cln->xmit_buf->size; cln->xmit_pos += k) {
k = write(cln->hnd.fd, cln->xmit_buf->buf + cln->xmit_pos, cln->xmit_buf->size - cln->xmit_pos);