FreeRTOS+TCP: Crash in FTP server if transfer socket cannot be created

jjr-simiatec wrote on Tuesday, July 02, 2019:

Version: FreeRTOS+TCP distributed as part of FreeRTOS v10.2.1

File: FreeRTOS_FTP_server.c, file version v2.03

In function prvTransferConnect(), if the socket cannot be created the return value xResult is set to an error code. However, the return value from prvTransferConnect() is treated as boolean by all callers of that function. This results in a NULL pointer dereference when pxClient->xTransferSocket is used later on. Example: in the handling of ECMD_PASV in prvProcessCommand().

Fix: Function prvTransferConnect(), line 901: Change -pdFREERTOS_ERRNO_ENOMEM to pdFALSE.

heinbali01 wrote on Tuesday, July 02, 2019:

John, free beers for you!
Thank you very much for noticing this, and taking the efffort to report it.
I will change it and try to get it updated in the repo.

Just to make sure, I will attach my latest versions of the FAT library and the servers:

FreeRTOS_FTP_HTTP_servers_2_july_2019.7z (26.5 KB)
FreeRTOS-Plus-FAT_2_july_2019.7z (152.0 KB)

These are a official releases. The server code is just as a demo of how to use the lirbaries.

Correction, should have been: “These are non-official releases”

heinbali01 wrote on Tuesday, July 02, 2019:

I wrote:

These are a official releases.

Correction, that should be “These are non-official releases”.

FreeRTOS_FTP_server. in te 7zip file already contains the change that you propose:

+		xResult = pdFALSE;