From a0fb7a76cd335ad4cae118a0fec731d748ec94c6 Mon Sep 17 00:00:00 2001 From: danicampora Date: Wed, 28 Oct 2015 00:06:51 +0100 Subject: [PATCH] cc3200: Fix bug in FTP command buffer, and set listening backlog to 0. --- cc3200/ftp/ftp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cc3200/ftp/ftp.c b/cc3200/ftp/ftp.c index 221fede058..dc21ebb483 100644 --- a/cc3200/ftp/ftp.c +++ b/cc3200/ftp/ftp.c @@ -248,7 +248,7 @@ void ftp_run (void) { ftp_wait_for_enabled(); break; case E_FTP_STE_START: - if (wlan_is_connected() && ftp_create_listening_socket(&ftp_data.lc_sd, FTP_CMD_PORT, FTP_CMD_CLIENTS_MAX)) { + if (wlan_is_connected() && ftp_create_listening_socket(&ftp_data.lc_sd, FTP_CMD_PORT, FTP_CMD_CLIENTS_MAX - 1)) { ftp_data.state = E_FTP_STE_READY; } break; @@ -612,7 +612,7 @@ static void ftp_process_cmd (void) { ftp_data.closechild = false; // also use the reply buffer to receive new commands - if (E_FTP_RESULT_OK == (result = ftp_recv_non_blocking(ftp_data.c_sd, ftp_cmd_buffer, FTP_BUFFER_SIZE, &len))) { + if (E_FTP_RESULT_OK == (result = ftp_recv_non_blocking(ftp_data.c_sd, ftp_cmd_buffer, FTP_MAX_PARAM_SIZE + FTP_CMD_SIZE_MAX, &len))) { // bufptr is moved as commands are being popped ftp_cmd_index_t cmd = ftp_pop_command(&bufptr); if (!ftp_data.loggin.passvalid && (cmd != E_FTP_CMD_USER && cmd != E_FTP_CMD_PASS && cmd != E_FTP_CMD_QUIT)) { @@ -707,7 +707,7 @@ static void ftp_process_cmd (void) { ftp_data.substate = E_FTP_STE_SUB_DISCONNECTED; bool socketcreated = true; if (ftp_data.ld_sd < 0) { - socketcreated = ftp_create_listening_socket(&ftp_data.ld_sd, FTP_PASIVE_DATA_PORT, FTP_DATA_CLIENTS_MAX); + socketcreated = ftp_create_listening_socket(&ftp_data.ld_sd, FTP_PASIVE_DATA_PORT, FTP_DATA_CLIENTS_MAX - 1); } if (socketcreated) { uint32_t ip;