This is an automated email from Gerrit.

"Paul Fertser <fercer...@gmail.com>" just uploaded a new patch set to Gerrit, 
which you can find at https://review.openocd.org/c/openocd/+/8597

-- gerrit

commit 303ec9a71cdd2185cdbccfe81acb0b89f43183a9
Author: Paul Fertser <fercer...@gmail.com>
Date:   Tue Nov 26 22:55:55 2024 +0200

    rtos: mqx: replace malloc+strcpy with strdup
    
    Using strcpy is potentially dangerous so just use a safer and easier way
    to do the same.
    
    Signed-off-by: Paul Fertser <fercer...@gmail.com>
    Change-Id: Id85f3b7f8af1eaf14c9951ae710546d2437c70b5

diff --git a/src/rtos/mqx.c b/src/rtos/mqx.c
index b4a1821352..90154db3ff 100644
--- a/src/rtos/mqx.c
+++ b/src/rtos/mqx.c
@@ -380,10 +380,9 @@ static int mqx_update_threads(
                rtos->thread_details[i].threadid = task_id;
                rtos->thread_details[i].exists = true;
                /* set thread name */
-               rtos->thread_details[i].thread_name_str = malloc(strlen((void 
*)task_name) + 1);
+               rtos->thread_details[i].thread_name_str = strdup((char 
*)task_name);
                if (!rtos->thread_details[i].thread_name_str)
                        return ERROR_FAIL;
-               strcpy(rtos->thread_details[i].thread_name_str, (void 
*)task_name);
                /* set thread extra info
                 * - task state
                 * - task address

-- 

Reply via email to