A bit more safe string copy
authorChristophe <christophe@lunarg.com>
Mon, 13 Feb 2023 14:47:55 +0000 (15:47 +0100)
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>
Tue, 14 Feb 2023 17:30:44 +0000 (10:30 -0700)
loader/loader.c

index 6831bca..95d5f9b 100644 (file)
@@ -4720,7 +4720,7 @@ VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, c
             size_t size = strlen(pCreateInfo->ppEnabledLayerNames[i]) + 1;
             inst->enabled_layer_names[i] =
                 (char *)loader_instance_heap_calloc(inst, sizeof(char) * size, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
-            strcpy(inst->enabled_layer_names[i], pCreateInfo->ppEnabledLayerNames[i]);
+            strncpy(inst->enabled_layer_names[i], pCreateInfo->ppEnabledLayerNames[i], strlen(pCreateInfo->ppEnabledLayerNames[i]));
         }
     }