From 175fc1790a76a5a8d57ecd644af46bf58e90a9b6 Mon Sep 17 00:00:00 2001 From: Jake Hageman Date: Thu, 16 Sep 2021 17:49:14 -0400 Subject: [PATCH] Fix #1959, Make invalid buffer length consistent in es task test --- modules/cfe_testcase/src/es_task_test.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/cfe_testcase/src/es_task_test.c b/modules/cfe_testcase/src/es_task_test.c index 063e67a6c..9ddd319b0 100644 --- a/modules/cfe_testcase/src/es_task_test.c +++ b/modules/cfe_testcase/src/es_task_test.c @@ -192,8 +192,7 @@ void TestChildTaskName(void) UtPrintf("Testing: CFE_ES_GetTaskIDByName, CFE_ES_GetTaskName"); CFE_ES_TaskId_t TaskId; - const char * TaskName = "CHILD_TASK_1"; - const char INVALID_TASK_NAME[] = "INVALID_NAME"; + const char TaskName[] = "CHILD_TASK_1"; CFE_ES_TaskId_t TaskIdByName; char TaskNameBuf[OS_MAX_API_NAME + 4]; CFE_ES_StackPointer_t StackPointer = CFE_ES_TASK_STACK_ALLOCATE; @@ -212,13 +211,14 @@ void TestChildTaskName(void) UtAssert_INT32_EQ(CFE_ES_GetTaskIDByName(NULL, TaskName), CFE_ES_BAD_ARGUMENT); UtAssert_INT32_EQ(CFE_ES_GetTaskIDByName(&TaskIdByName, NULL), CFE_ES_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_ES_GetTaskIDByName(&TaskIdByName, INVALID_TASK_NAME), CFE_ES_ERR_NAME_NOT_FOUND); + UtAssert_INT32_EQ(CFE_ES_GetTaskIDByName(&TaskIdByName, "INVALID_NAME"), CFE_ES_ERR_NAME_NOT_FOUND); CFE_UtAssert_RESOURCEID_UNDEFINED(TaskIdByName); UtAssert_INT32_EQ(CFE_ES_GetTaskName(NULL, TaskId, sizeof(TaskNameBuf)), CFE_ES_BAD_ARGUMENT); UtAssert_INT32_EQ(CFE_ES_GetTaskName(TaskNameBuf, CFE_ES_TASKID_UNDEFINED, sizeof(TaskNameBuf)), CFE_ES_ERR_RESOURCEID_NOT_VALID); - UtAssert_INT32_EQ(CFE_ES_GetTaskName(TaskNameBuf, TaskId, sizeof(TaskName) - 4), CFE_ES_ERR_RESOURCEID_NOT_VALID); + UtAssert_INT32_EQ(CFE_ES_GetTaskName(TaskNameBuf, TaskId, 0), CFE_ES_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_ES_GetTaskName(TaskNameBuf, TaskId, sizeof(TaskName) - 1), CFE_ES_ERR_RESOURCEID_NOT_VALID); UtAssert_INT32_EQ(CFE_ES_DeleteChildTask(TaskId), CFE_SUCCESS); }