From f648ab5f090ab44f344d69f1b07aab86afbb8e00 Mon Sep 17 00:00:00 2001 From: "W. Eric Norum" Date: Mon, 27 Mar 2006 20:47:05 +0000 Subject: [PATCH] Ensure that RTEMS-style names are properly terminated. --- src/libCom/osi/os/RTEMS/osdThread.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/libCom/osi/os/RTEMS/osdThread.c b/src/libCom/osi/os/RTEMS/osdThread.c index 53841a15d..da265960c 100644 --- a/src/libCom/osi/os/RTEMS/osdThread.c +++ b/src/libCom/osi/os/RTEMS/osdThread.c @@ -424,11 +424,15 @@ void epicsThreadGetName (epicsThreadId id, char *name, size_t size) Objects_Locations l; if ((thr=_Thread_Get(tid, &l)) != NULL) { if (OBJECTS_LOCAL == l) { - Objects_Information *oi; - oi = _Objects_Get_information(tid); - _Objects_Copy_name_raw( &thr->Object.name, name, - size > oi->name_length ? oi->name_length : size); + int length; + Objects_Information *oi = _Objects_Get_information(tid); + if (oi->name_length >= size) + length = size - 1; + else + length = oi->name_length; + _Objects_Copy_name_raw( &thr->Object.name, name, length); haveName = 1; + name[length] = '\0'; } _Thread_Enable_dispatch(); }