proc_test: fix buffer overflow.
authorarighi <arighi@38d2e660-2303-0410-9eaa-f027e97ec537>
Wed, 17 Mar 2010 18:31:05 +0000 (18:31 +0000)
committerarighi <arighi@38d2e660-2303-0410-9eaa-f027e97ec537>
Wed, 17 Mar 2010 18:31:05 +0000 (18:31 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3232 38d2e660-2303-0410-9eaa-f027e97ec537

bertos/kern/proc_test.c

index 46a057f468a665a3a954df164d4d9ce5609fec17..ebb160627a6c35ff31d8e15e6b5a1aac3c941ea8 100644 (file)
@@ -127,7 +127,7 @@ static int worker_test(void)
        {
                name[i][0] = '\0';
                snprintf(&name[i][0], sizeof(name[i]), "worker_%zd", i + 1);
-               name[i][sizeof(name) - 1] = '\0';
+               name[i][sizeof(name[i]) - 1] = '\0';
                proc_new_with_name(name[i], worker, (iptr_t)(i + 1),
                                WORKER_STACK_SIZE,
                                (cpu_stack_t *)((size_t)&worker_stack + WORKER_STACK_SIZE * i));
@@ -204,7 +204,7 @@ static int preempt_worker_test(void)
                name[i][0] = '\0';
                snprintf(&name[i][0], sizeof(name[i]),
                                "preempt_worker_%zd", i + 1);
-               name[i][sizeof(name) - 1] = '\0';
+               name[i][sizeof(name[i]) - 1] = '\0';
                proc_new_with_name(name[i], preempt_worker, (iptr_t)(i + 1),
                                WORKER_STACK_SIZE,
                                (cpu_stack_t *)((size_t)&worker_stack + WORKER_STACK_SIZE * i));