diff options
author | Benny Prijono <bennylp@teluu.com> | 2006-07-29 20:29:24 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2006-07-29 20:29:24 +0000 |
commit | 8437d671f9c4c0fdd2d5d29f8741173391196e1c (patch) | |
tree | d3be6f832e41d7f49fabd8cd91996ddd1b392418 /pjlib/src/pj/os_core_linux_kernel.c | |
parent | dfc70260daca970cc1df362f26fd669d75812eb0 (diff) |
Another take at fixing 64bit problems. PJ_MAX_OBJ_NAME is increased to 32 chars (from 16), and check all those sprintf's especially the ones with "%p" format.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@635 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/src/pj/os_core_linux_kernel.c')
-rw-r--r-- | pjlib/src/pj/os_core_linux_kernel.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/pjlib/src/pj/os_core_linux_kernel.c b/pjlib/src/pj/os_core_linux_kernel.c index ee0f3452..97d5fce5 100644 --- a/pjlib/src/pj/os_core_linux_kernel.c +++ b/pjlib/src/pj/os_core_linux_kernel.c @@ -138,8 +138,10 @@ static void thread_initialize( pj_thread_t *thread ) /* initialise termination flag */ thread->terminate = 0; - /* set name of this process (max 15 chars + 0 !) */ - thread->obj_name[15] = '\0'; + /* set name of this process (making sure obj_name is null + * terminated first) + */ + thread->obj_name[PJ_MAX_OBJ_NAME-1] = '\0'; sprintf(current->comm, thread->obj_name); /* tell the creator that we are ready and let him continue */ @@ -266,7 +268,8 @@ PJ_DEF(pj_status_t) pj_thread_register ( const char *cstr_thread_name, if(cstr_thread_name && pj_strlen(&thread_name) < sizeof(thread->obj_name)-1) pj_sprintf(thread->obj_name, cstr_thread_name, thread->thread); else - pj_sprintf(thread->obj_name, "thr%p", (void*)thread->thread); + pj_snprintf(thread->obj_name, sizeof(thread->obj_name), + "thr%p", (void*)thread->thread); /* Initialize. */ thread_initialize(thread); |