Fix: strncpy() may leave pcWriteBuffer non-null-terminated in FreeRTOS_CLI.c (#1422)
CI Checks / git-secrets (push) Has been cancelled
CI Checks / formatting (push) Has been cancelled
CI Checks / spell-check (push) Has been cancelled
CI Checks / doxygen (push) Has been cancelled
CI Checks / verify-manifest (push) Has been cancelled
CI Checks / memory-statistics (push) Has been cancelled
CI Checks / proof_ci (push) Has been cancelled
FreeRTOS Demos / WIN32 MSVC (push) Has been cancelled
FreeRTOS Demos / WIN32 MingW (push) Has been cancelled
FreeRTOS Demos / Posix GCC (push) Has been cancelled
FreeRTOS Demos / GNU MSP430 Toolchain (push) Has been cancelled
FreeRTOS Demos / GNU ARM Toolchain (push) Has been cancelled
FreeRTOS MPU Demo / TI-Hercules RM46 and RM57 MPU Demos (push) Has been cancelled
Build FreeRTOS+ Demos / Windows Simulator Cellular Demos (push) Has been cancelled
Build FreeRTOS+ Demos / coreHTTP WinSim Demos (push) Has been cancelled
Build FreeRTOS+ Demos / corePKCS11 WinSim Demos (push) Has been cancelled
Build FreeRTOS+ Demos / core Library Windows Simulator Demos (push) Has been cancelled
Build FreeRTOS+ Demos / AWS IoT Windows Simulator Demos (push) Has been cancelled
Build FreeRTOS+ Demos / FreeRTOS+TCP Posix Simulator Demo (push) Has been cancelled
Build FreeRTOS+ Demos / FreeRTOS+TCP QEMU ARM MPS2 AN385 (push) Has been cancelled
Build FreeRTOS+ Demos / FreeRTOS+TCP Windows Simulator Demos (push) Has been cancelled
Build FreeRTOS+ Demos / FreeRTOS+CLI Windows Simulator Demos (push) Has been cancelled
Kernel Unit Tests / FreeRTOS/Source Submodule Revision (push) Has been cancelled
Kernel Unit Tests / FreeRTOS-Kernel Main Branch (push) Has been cancelled

This commit is contained in:
ARYA MGC
2026-07-15 09:35:29 -07:00
committed by GitHub
parent c73a397a41
commit 0e199e6d06
@@ -201,6 +201,7 @@ BaseType_t FreeRTOS_CLIProcessCommand( const char * const pcCommandInput,
/* The command was found, but the number of parameters with the command
* was incorrect. */
strncpy( pcWriteBuffer, "Incorrect command parameter(s). Enter \"help\" to view a list of available commands.\r\n\r\n", xWriteBufferLen );
pcWriteBuffer[ xWriteBufferLen - 1 ] = '\0';
pxCommand = NULL;
}
else if( pxCommand != NULL )
@@ -220,6 +221,7 @@ BaseType_t FreeRTOS_CLIProcessCommand( const char * const pcCommandInput,
{
/* pxCommand was NULL, the command was not found. */
strncpy( pcWriteBuffer, "Command not recognised. Enter 'help' to view a list of available commands.\r\n\r\n", xWriteBufferLen );
pcWriteBuffer[ xWriteBufferLen - 1 ] = '\0';
xReturn = pdFALSE;
}
@@ -340,6 +342,7 @@ static BaseType_t prvHelpCommand( char * pcWriteBuffer,
/* Return the next command help string, before moving the pointer on to
* the next command in the list. */
strncpy( pcWriteBuffer, pxCommand->pxCommandLineDefinition->pcHelpString, xWriteBufferLen );
pcWriteBuffer[ xWriteBufferLen - 1 ] = '\0';
pxCommand = pxCommand->pxNext;
if( pxCommand == NULL )