Skip to content

Commit b749134

Browse files
unamedkrclaude
andcommitted
Fix strncpy truncation warning in Vulkan device selection
Replace strncpy with memset+memcpy to avoid GCC -Wstringop-truncation warning when copying device name. Relates to #9 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 836e117 commit b749134

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/backend/vulkan/tq_vulkan_init.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,9 @@ static int tq_vk_select_device(void) {
198198
/* Store device properties */
199199
VkPhysicalDeviceProperties props;
200200
vkGetPhysicalDeviceProperties(g_vk_state.physical_device, &props);
201-
strncpy(g_vk_state.device_name, props.deviceName,
202-
sizeof(g_vk_state.device_name) - 1);
201+
memset(g_vk_state.device_name, 0, sizeof(g_vk_state.device_name));
202+
memcpy(g_vk_state.device_name, props.deviceName,
203+
sizeof(g_vk_state.device_name) - 1);
203204

204205
/* Query subgroup properties (Vulkan 1.1) */
205206
VkPhysicalDeviceSubgroupProperties subgroup_props = {0};

0 commit comments

Comments
 (0)