|
@@ -2884,14 +2884,14 @@ static portBASE_TYPE prvTaskFTPCommand(cli_state_t *cli_state, int8_t *pcWriteBu
|
|
}
|
|
}
|
|
|
|
|
|
/* Obtain the parameter string. */
|
|
/* Obtain the parameter string. */
|
|
- pcParameterString = ( int8_t * ) FreeRTOS_CLIGetParameter
|
|
|
|
|
|
+ pcParameterString = (int8_t *)FreeRTOS_CLIGetParameter
|
|
(
|
|
(
|
|
pcCommandString, /* The command string itself. */
|
|
pcCommandString, /* The command string itself. */
|
|
xParameterNumber, /* Return the next parameter. */
|
|
xParameterNumber, /* Return the next parameter. */
|
|
&xParameterStringLength /* Store the parameter string length. */
|
|
&xParameterStringLength /* Store the parameter string length. */
|
|
);
|
|
);
|
|
for (i = 0; i < ARG_FTP_ALL; i ++) {
|
|
for (i = 0; i < ARG_FTP_ALL; i ++) {
|
|
- if ( strncmp( ( const char * ) pcParameterString, ftp_args_list[i], strlen(ftp_args_list[i]) ) == 0
|
|
|
|
|
|
+ if (strncmp((const char *)pcParameterString, ftp_args_list[i], strlen(ftp_args_list[i])) == 0
|
|
&& xParameterStringLength == strlen(ftp_args_list[i])) {
|
|
&& xParameterStringLength == strlen(ftp_args_list[i])) {
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -2907,7 +2907,7 @@ static portBASE_TYPE prvTaskFTPCommand(cli_state_t *cli_state, int8_t *pcWriteBu
|
|
);
|
|
);
|
|
memset(str, 0, sizeof(str));
|
|
memset(str, 0, sizeof(str));
|
|
if (xParameterStringLength > 3) {
|
|
if (xParameterStringLength > 3) {
|
|
- strncpy((char *)pcWriteBuffer, (const char *)pcInvalidCommand, strlen((char *)pcInvalidCommand));
|
|
|
|
|
|
+ strcpy((char *)pcWriteBuffer, (const char *)pcInvalidCommand);
|
|
return pdFALSE;
|
|
return pdFALSE;
|
|
}
|
|
}
|
|
strncat(str, (const char *) pcParameterString, xParameterStringLength);
|
|
strncat(str, (const char *) pcParameterString, xParameterStringLength);
|
|
@@ -2917,7 +2917,7 @@ static portBASE_TYPE prvTaskFTPCommand(cli_state_t *cli_state, int8_t *pcWriteBu
|
|
;
|
|
;
|
|
ip_addr_t server_ip_old = sSettings.sFTPUpdate.server_ip;
|
|
ip_addr_t server_ip_old = sSettings.sFTPUpdate.server_ip;
|
|
if (!ipaddr_aton(str, &sSettings.sFTPUpdate.server_ip)) {
|
|
if (!ipaddr_aton(str, &sSettings.sFTPUpdate.server_ip)) {
|
|
- strncpy((char *)pcWriteBuffer, (const char *)pcInvalidCommand, strlen((char *)pcInvalidCommand));
|
|
|
|
|
|
+ strcpy((char *)pcWriteBuffer, (const char *)pcInvalidCommand);
|
|
return pdFALSE;
|
|
return pdFALSE;
|
|
}
|
|
}
|
|
if (!ip_addr_cmp(&sSettings.sFTPUpdate.server_ip, &server_ip_old)) {
|
|
if (!ip_addr_cmp(&sSettings.sFTPUpdate.server_ip, &server_ip_old)) {
|
|
@@ -2929,7 +2929,7 @@ static portBASE_TYPE prvTaskFTPCommand(cli_state_t *cli_state, int8_t *pcWriteBu
|
|
u16_t server_port_old = sSettings.sFTPUpdate.server_port;
|
|
u16_t server_port_old = sSettings.sFTPUpdate.server_port;
|
|
int temp = atoi(str);
|
|
int temp = atoi(str);
|
|
if (temp < 0 || temp > 65535) {
|
|
if (temp < 0 || temp > 65535) {
|
|
- strncpy((char *)pcWriteBuffer, (const char *)pcInvalidCommand, strlen((char *)pcInvalidCommand));
|
|
|
|
|
|
+ strcpy((char *)pcWriteBuffer, (const char *)pcInvalidCommand);
|
|
return pdFALSE;
|
|
return pdFALSE;
|
|
} else {
|
|
} else {
|
|
sSettings.sFTPUpdate.server_port = temp;
|
|
sSettings.sFTPUpdate.server_port = temp;
|
|
@@ -2941,7 +2941,7 @@ static portBASE_TYPE prvTaskFTPCommand(cli_state_t *cli_state, int8_t *pcWriteBu
|
|
case ARG_FTP_remote_path: {
|
|
case ARG_FTP_remote_path: {
|
|
unsigned len = strlen(str);
|
|
unsigned len = strlen(str);
|
|
if (len < 1 || len >= sizeof(sSettings.sFTPUpdate.remote_path)) {
|
|
if (len < 1 || len >= sizeof(sSettings.sFTPUpdate.remote_path)) {
|
|
- strncpy((char *)pcWriteBuffer, (const char *)pcInvalidCommand, strlen((char *)pcInvalidCommand));
|
|
|
|
|
|
+ strcpy((char *)pcWriteBuffer, (const char *)pcInvalidCommand);
|
|
return pdFALSE;
|
|
return pdFALSE;
|
|
} else {
|
|
} else {
|
|
strcpy(&sSettings.sFTPUpdate.remote_path, str);
|
|
strcpy(&sSettings.sFTPUpdate.remote_path, str);
|
|
@@ -2951,7 +2951,7 @@ static portBASE_TYPE prvTaskFTPCommand(cli_state_t *cli_state, int8_t *pcWriteBu
|
|
case ARG_FTP_user: {
|
|
case ARG_FTP_user: {
|
|
unsigned len = strlen(str);
|
|
unsigned len = strlen(str);
|
|
if (len < 1 || len >= sizeof(sSettings.sFTPUpdate.user)) {
|
|
if (len < 1 || len >= sizeof(sSettings.sFTPUpdate.user)) {
|
|
- strncpy((char *)pcWriteBuffer, (const char *)pcInvalidCommand, strlen((char *)pcInvalidCommand));
|
|
|
|
|
|
+ strcpy((char *)pcWriteBuffer, (const char *)pcInvalidCommand);
|
|
return pdFALSE;
|
|
return pdFALSE;
|
|
} else {
|
|
} else {
|
|
strcpy(&sSettings.sFTPUpdate.user, str);
|
|
strcpy(&sSettings.sFTPUpdate.user, str);
|
|
@@ -2961,7 +2961,7 @@ static portBASE_TYPE prvTaskFTPCommand(cli_state_t *cli_state, int8_t *pcWriteBu
|
|
case ARG_FTP_pass: {
|
|
case ARG_FTP_pass: {
|
|
unsigned len = strlen(str);
|
|
unsigned len = strlen(str);
|
|
if (len < 1 || len >= sizeof(sSettings.sFTPUpdate.pass)) {
|
|
if (len < 1 || len >= sizeof(sSettings.sFTPUpdate.pass)) {
|
|
- strncpy((char *)pcWriteBuffer, (const char *)pcInvalidCommand, strlen((char *)pcInvalidCommand));
|
|
|
|
|
|
+ strcpy((char *)pcWriteBuffer, (const char *)pcInvalidCommand);
|
|
return pdFALSE;
|
|
return pdFALSE;
|
|
} else {
|
|
} else {
|
|
strcpy(&sSettings.sFTPUpdate.pass, str);
|
|
strcpy(&sSettings.sFTPUpdate.pass, str);
|
|
@@ -2971,9 +2971,10 @@ static portBASE_TYPE prvTaskFTPCommand(cli_state_t *cli_state, int8_t *pcWriteBu
|
|
case ARG_FTP_run: {
|
|
case ARG_FTP_run: {
|
|
ftpcfg.settings = &sSettings.sFTPUpdate;
|
|
ftpcfg.settings = &sSettings.sFTPUpdate;
|
|
start_ftp_client(&ftpcfg);
|
|
start_ftp_client(&ftpcfg);
|
|
|
|
+ strcpy((char *)pcWriteBuffer, "Начато обновление ПО по FTP\r\n");
|
|
break; }
|
|
break; }
|
|
default:
|
|
default:
|
|
- strncpy((char *)pcWriteBuffer, (const char *)pcInvalidCommand, strlen((char *)pcInvalidCommand));
|
|
|
|
|
|
+ strcpy((char *)pcWriteBuffer, (const char *)pcInvalidCommand);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
xReturn = pdFALSE;
|
|
xReturn = pdFALSE;
|