Merge pull request #3714 from donaldsharp/thread_strlcpy

lib: snprintf to strlcpy in frr_pthread.c
This commit is contained in:
Mark Stapp 2019-01-31 15:32:38 +01:00 committed by GitHub
commit 41e8603bfa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -83,9 +83,9 @@ struct frr_pthread *frr_pthread_new(struct frr_pthread_attr *attr,
name = (name ? name : "Anonymous thread");
fpt->name = XSTRDUP(MTYPE_FRR_PTHREAD, name);
if (os_name)
snprintf(fpt->os_name, OS_THREAD_NAMELEN, "%s", os_name);
strlcpy(fpt->os_name, os_name, OS_THREAD_NAMELEN);
else
snprintf(fpt->os_name, OS_THREAD_NAMELEN, "%s", name);
strlcpy(fpt->os_name, name, OS_THREAD_NAMELEN);
/* initialize startup synchronization primitives */
fpt->running_cond_mtx = XCALLOC(
MTYPE_PTHREAD_PRIM, sizeof(pthread_mutex_t));