Validate timer command ID lower bound in xTimerGenericCommandFromTask (#1477)
The task command path validated the command ID only against the upper bound. Add the corresponding lower-bound check so the accepted range is fully constrained.
diff --git a/timers.c b/timers.c
index 1bc40bc..b978f42 100644
--- a/timers.c
+++ b/timers.c
@@ -467,9 +467,11 @@
xMessage.u.xTimerParameters.xMessageValue = xOptionalValue;
xMessage.u.xTimerParameters.pxTimer = xTimer;
- configASSERT( xCommandID < tmrFIRST_FROM_ISR_COMMAND );
+ /* Enforce a lower bound as well as an upper bound so that only
+ * valid task-issued commands are accepted here. */
+ configASSERT( ( xCommandID >= tmrCOMMAND_START_DONT_TRACE ) && ( xCommandID < tmrFIRST_FROM_ISR_COMMAND ) );
- if( xCommandID < tmrFIRST_FROM_ISR_COMMAND )
+ if( ( xCommandID >= tmrCOMMAND_START_DONT_TRACE ) && ( xCommandID < tmrFIRST_FROM_ISR_COMMAND ) )
{
if( xTaskGetSchedulerState() == taskSCHEDULER_RUNNING )
{