mirror of
https://github.com/wiiu-env/ftpiiu_plugin.git
synced 2024-11-16 17:59:19 +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 */
|
||||
if(command == NULL)
|
||||
{
|
||||
/* remove CRLF from buffer, if exists */
|
||||
char *crlf_loc = strstr(buffer, "\r\n");
|
||||
if (crlf_loc)
|
||||
*crlf_loc = '\0';
|
||||
ftp_send_response(session, 502, "Invalid command \"%s\"\r\n", buffer);
|
||||
/* send header */
|
||||
ftp_send_response(session, 502, "Invalid command \"");
|
||||
|
||||
/* send command */
|
||||
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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user