Bug in ftpsrv_help

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Bug in ftpsrv_help

352 Views
CorderBollie
Contributor II

Hello.

In MQX 4.1.1. there is a bug in function ftpsrv_help (ftpsrv_cmd.c).

If one adds custom FTP commands so that the overall number of FTP commands is no longer a multiple of 4, then the remotehelp command will no longer work correctly.

I identified line 255 in ftpsrv_help being the problem where a closing "\r\n" is appended to the buffer.

However the counter 'space' is not decremented by two and the closing "\r\n" is not send.

The effect of this is that you are not able to enter any command in a ftp client when you call 'remotehelp'.

I fixed this like:

if (n)
{
    space -= snprintf(buffer+length, space, "\r\n");
}
/* Send command list from the buffer and set message to HELP end text */
send(session->control_sock, buffer, FTPSRV_BUF_SIZE-space, 0);

Labels (1)
Tags (2)
0 Kudos
1 Reply

259 Views
karelm_
Contributor IV

Hi,

Thank you for your effort. We already fixed this bug for next release of MQX.

Best regards,

Kare

0 Kudos