mirror of
https://github.com/wiiu-env/ftpiiu_plugin.git
synced 2024-12-23 03:11:49 +01:00
Encode invalid command response
This commit is contained in:
parent
5e8fb219e3
commit
44f8eaf55d
31
source/ftp.c
31
source/ftp.c
@ -1221,11 +1221,32 @@ ftp_session_read_command(ftp_session_t *session,
|
|||||||
/* execute the command */
|
/* execute the command */
|
||||||
if(command == NULL)
|
if(command == NULL)
|
||||||
{
|
{
|
||||||
/* remove CRLF from buffer, if exists */
|
/* send header */
|
||||||
char *crlf_loc = strstr(buffer, "\r\n");
|
ftp_send_response(session, 502, "Invalid command \"");
|
||||||
if (crlf_loc)
|
|
||||||
*crlf_loc = '\0';
|
/* send command */
|
||||||
ftp_send_response(session, 502, "Invalid command \"%s\"\r\n", buffer);
|
len = strlen(buffer);
|
||||||
|
buffer = encode_path(buffer, &len, false);
|
||||||
|
if(buffer != NULL)
|
||||||
|
ftp_send_response_buffer(session, buffer, len);
|
||||||
|
else
|
||||||
|
ftp_send_response_buffer(session, key.name, strlen(key.name));
|
||||||
|
free(buffer);
|
||||||
|
|
||||||
|
/* send args (if any) */
|
||||||
|
if(*args != 0)
|
||||||
|
{
|
||||||
|
len = strlen(args);
|
||||||
|
buffer = encode_path(args, &len, false);
|
||||||
|
if(buffer != NULL)
|
||||||
|
ftp_send_response_buffer(session, buffer, len);
|
||||||
|
else
|
||||||
|
ftp_send_response_buffer(session, args, strlen(args));
|
||||||
|
free(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* send footer */
|
||||||
|
ftp_send_response_buffer(session, "\"\r\n", 3);
|
||||||
}
|
}
|
||||||
else if(session->state != COMMAND_STATE)
|
else if(session->state != COMMAND_STATE)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user