diff options
Diffstat (limited to 'accel-pptpd')
-rw-r--r-- | accel-pptpd/cli/tcp.c | 38 | ||||
-rw-r--r-- | accel-pptpd/ctrl/pppoe/pppoe.c | 4 |
2 files changed, 22 insertions, 20 deletions
diff --git a/accel-pptpd/cli/tcp.c b/accel-pptpd/cli/tcp.c index 7b44da7..687c97f 100644 --- a/accel-pptpd/cli/tcp.c +++ b/accel-pptpd/cli/tcp.c @@ -154,31 +154,35 @@ static int cln_read(struct triton_md_handler_t *h) } cln->recv_pos += n; - - d = strchr((char *)cln->cmdline, '\n'); - if (!d) { - if (cln->recv_pos == RECV_BUF_SIZE) { - log_warn("cli: tcp: recv buffer overflow\n"); + + while (cln->recv_pos) { + d = strchr((char *)cln->cmdline, '\n'); + if (!d) { + if (cln->recv_pos == RECV_BUF_SIZE) { + log_warn("cli: tcp: recv buffer overflow\n"); + goto drop; + } break; } - continue; - } - *d = 0; + *d = 0; - if (!cln->auth) { - if (strcmp((char *)cln->cmdline, conf_cli_passwd)) - break; - cln->auth = 1; - } else - cli_process_cmd(&cln->cli_client); + if (!cln->auth) { + if (strcmp((char *)cln->cmdline, conf_cli_passwd)) + goto drop; + cln->auth = 1; + } else + cli_process_cmd(&cln->cli_client); - if (cln->disconnect) - break; + if (cln->disconnect) + goto drop; - memmove(cln->cmdline, d + 1, cln->recv_pos - ((uint8_t *)d + 1 - cln->cmdline)); + cln->recv_pos -= (uint8_t *)d + 1 - cln->cmdline; + memmove(cln->cmdline, d + 1, cln->recv_pos); + } } +drop: disconnect(cln); return 0; } diff --git a/accel-pptpd/ctrl/pppoe/pppoe.c b/accel-pptpd/ctrl/pppoe/pppoe.c index 0761609..eacecc9 100644 --- a/accel-pptpd/ctrl/pppoe/pppoe.c +++ b/accel-pptpd/ctrl/pppoe/pppoe.c @@ -583,9 +583,7 @@ static void pppoe_recv_PADI(struct pppoe_serv_t *serv, uint8_t *pack, int size) case TAG_END_OF_LIST: break; case TAG_SERVICE_NAME: - if (tag->tag_len == 0) - service_match = 1; - else if (conf_service_name) { + if (conf_service_name && tag->tag_len) { if (ntohs(tag->tag_len) != strlen(conf_service_name)) break; if (memcmp(tag->tag_data, conf_service_name, ntohs(tag->tag_len))) |