AnsweredAssumed Answered

MQX 4.1.1. FTPSRV_init memory allocation

Question asked by CorderBollie on Oct 14, 2014
Latest reply on Oct 15, 2014 by Matthew Kendall

Hello.

I found an issue with the FTPSRV_init function of RTCS in MQX 4.1.1.

 

The function uses RTCS_mem_alloc_zero to allocate memory for its FTPSRV_STRUCT, the session pointer and session task ID's.

However if this function is called from a task (e.g. an initialization task) that runs out normally then the allocated memory is freed in _task_destroy.

Now, if an other task allocateds memory, it is possible that the session struct and semaphores are overwritten in memory while the ftp task is running.

This leads to exceptions in various other tasks that are using semaphores also because the LWSEM list of the kernel data is now broken.

 

To make a long story short, I think that FTPSRV_init should use RTCS_MEM_alloc_system_zero to allocate memory.

Outcomes