AnsweredAssumed Answered

Bug in ftpsrv_help

Question asked by CorderBollie on Oct 7, 2014
Latest reply on Oct 7, 2014 by Karel Mozny


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);