]> granicus.if.org Git - esp-idf/commitdiff
fix buffer overflow in ipc.c
authorzhangyanjiao <zhangyanjiao@espressif.com>
Mon, 27 Nov 2017 07:58:36 +0000 (15:58 +0800)
committerzhangyanjiao <zhangyanjiao@espressif.com>
Mon, 27 Nov 2017 10:47:40 +0000 (18:47 +0800)
components/esp32/ipc.c

index 4f6398364af8cce466e5b124eb6a7364b9acb95f..aedf4edb3b378a76a1d8dfb2988c21baccee2a16 100644 (file)
@@ -77,10 +77,11 @@ void esp_ipc_init()
 {
     s_ipc_mutex = xSemaphoreCreateMutex();
     s_ipc_ack = xSemaphoreCreateBinary();
-    const char* task_names[2] = {"ipc0", "ipc1"};
+    char task_name[8];
     for (int i = 0; i < portNUM_PROCESSORS; ++i) {
+        sprintf(task_name,"ipc%d",i);
         s_ipc_sem[i] = xSemaphoreCreateBinary();
-        portBASE_TYPE res = xTaskCreatePinnedToCore(ipc_task, task_names[i], CONFIG_IPC_TASK_STACK_SIZE, (void*) i,
+        portBASE_TYPE res = xTaskCreatePinnedToCore(ipc_task, task_name, CONFIG_IPC_TASK_STACK_SIZE, (void*) i,
                                                     configMAX_PRIORITIES - 1, &s_ipc_tasks[i], i);
         assert(res == pdTRUE);
     }