From: arighi Date: Wed, 17 Mar 2010 15:39:08 +0000 (+0000) Subject: proc_test: use snprintf() instead of sprintf(). X-Git-Tag: 2.4.0~35 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=f3b36b6c628832f9a7c1fd497a816fcd0cac818c;p=bertos.git proc_test: use snprintf() instead of sprintf(). git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3229 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/kern/proc_test.c b/bertos/kern/proc_test.c index b7e385a5..63123237 100644 --- a/bertos/kern/proc_test.c +++ b/bertos/kern/proc_test.c @@ -125,7 +125,8 @@ static int worker_test(void) kputs("Run Proc test..\n"); for (i = 0; i < TASKS; i++) { - sprintf(&name[i][0], "worker_%zd", i + 1); + snprintf(&name[i][0], sizeof(name[i]), "worker_%zd", i + 1); + name[i][sizeof(name) - 1] = '\0'; proc_new_with_name(name[i], worker, (iptr_t)(i + 1), WORKER_STACK_SIZE, &worker_stack[i][0]); } @@ -202,7 +203,9 @@ static int preempt_worker_test(void) kputs("Run Preemption test..\n"); for (i = 0; i < TASKS; i++) { - sprintf(&preempt_name[i][0], "preempt_worker_%zd", i + 1); + snprintf(&preempt_name[i][0], sizeof(preempt_name[i]), + "preempt_worker_%zd", i + 1); + preempt_name[i][sizeof(preempt_name) - 1] = '\0'; proc_new_with_name(preempt_name[i], preempt_worker, (iptr_t)(i + 1), WORKER_STACK_SIZE, &preempt_worker_stack[i][0]); }