You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The CFE_ES_GetTaskName function uses an OSAL API to perform its work. However, its error handling path is not complete, it assumes any underlying OSAL failure is due to the resource ID not being valid:
Although a bad ID is a likely cause for failure, it is not the only possible cause of failure - for example, if the name is too large to fit in the buffer, OSAL may return OS_ERR_NAME_TOO_LONG.
To Reproduce
Call CFE_ES_GetTaskName with a valid task ID and string buffer size of 1 (such that the task name is too long to fit in the buffer). The function will return CFE_ES_ERR_RESOURCEID_NOT_VALID status, even though the real error was that the buffer was too short.
Expected behavior
Should do better error conversion - only OS_ERR_INVALID_ID should translate to CFE_ES_ERR_RESOURCEID_NOT_VALID, and other potential/foreseeable OSAL errors converted to the nearest CFE ES error, or the generic catch-all CFE_STATUS_EXTERNAL_RESOURCE_FAIL can be returned for other unexpected/unhandled errors.
Additional context
See #1599, for Caelum will document the existing behavior, but a future release should correct this.
Reporter Info
Joseph Hickey, Vantage Systems, Inc.
The text was updated successfully, but these errors were encountered:
Describe the bug
The CFE_ES_GetTaskName function uses an OSAL API to perform its work. However, its error handling path is not complete, it assumes any underlying OSAL failure is due to the resource ID not being valid:
cFE/modules/es/fsw/src/cfe_es_api.c
Lines 988 to 993 in a16c78e
Although a bad ID is a likely cause for failure, it is not the only possible cause of failure - for example, if the name is too large to fit in the buffer, OSAL may return
OS_ERR_NAME_TOO_LONG
.To Reproduce
Call
CFE_ES_GetTaskName
with a valid task ID and string buffer size of 1 (such that the task name is too long to fit in the buffer). The function will returnCFE_ES_ERR_RESOURCEID_NOT_VALID
status, even though the real error was that the buffer was too short.Expected behavior
Should do better error conversion - only
OS_ERR_INVALID_ID
should translate toCFE_ES_ERR_RESOURCEID_NOT_VALID
, and other potential/foreseeable OSAL errors converted to the nearest CFE ES error, or the generic catch-allCFE_STATUS_EXTERNAL_RESOURCE_FAIL
can be returned for other unexpected/unhandled errors.Additional context
See #1599, for Caelum will document the existing behavior, but a future release should correct this.
Reporter Info
Joseph Hickey, Vantage Systems, Inc.
The text was updated successfully, but these errors were encountered: