rtos/ThreadX: added check for NULL-named tasks

Thread name loading was not correctly handled if a ThreadX task has a NULL
name.

Signed-off-by: Giulio Fieramosca <giulio@glgprograms.it>
Change-Id: I03071930182bc2585b61ce5d8c67491710883dd6
Reviewed-on: https://review.openocd.org/c/openocd/+/7328
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
Giulio Fieramosca 2022-11-03 20:38:20 +01:00 committed by Antonio Borneo
parent 2bad55bf83
commit 2e9f04c11a
1 changed files with 14 additions and 9 deletions

View File

@ -370,6 +370,10 @@ static int threadx_update_threads(struct rtos *rtos)
} }
/* Read the thread name */ /* Read the thread name */
tmp_str[0] = '\x00';
/* Check if thread has a valid name */
if (name_ptr != 0) {
retval = retval =
target_read_buffer(rtos->target, target_read_buffer(rtos->target,
name_ptr, name_ptr,
@ -380,6 +384,7 @@ static int threadx_update_threads(struct rtos *rtos)
return retval; return retval;
} }
tmp_str[THREADX_THREAD_NAME_STR_SIZE - 1] = '\x00'; tmp_str[THREADX_THREAD_NAME_STR_SIZE - 1] = '\x00';
}
if (tmp_str[0] == '\x00') if (tmp_str[0] == '\x00')
strcpy(tmp_str, "No Name"); strcpy(tmp_str, "No Name");