mirror of
https://gitlab.freedesktop.org/mesa/vulkan-wsi-layer.git
synced 2025-12-24 21:40:07 +01:00
Improve error handling when copying extension name
The extension list now calls abort() if an extension name exceeding the length limit is copied. Change-Id: I105946b647ebd0087dc892d7c8a227628da31966 Signed-off-by: Fufu Fang <fufu.fang@arm.com>
This commit is contained in:
parent
9f1c4c1733
commit
a41dce418c
1 changed files with 2 additions and 3 deletions
|
|
@ -47,12 +47,11 @@ VkResult extension_list::add(const char *const *extensions, uint32_t count)
|
|||
for (uint32_t i = 0; i < count; i++)
|
||||
{
|
||||
auto &dst = m_ext_props[initial_size + i];
|
||||
strncpy(dst.extensionName, extensions[i], sizeof(dst.extensionName));
|
||||
|
||||
if (strlen(extensions[i]) >= sizeof(dst.extensionName))
|
||||
{
|
||||
dst.extensionName[sizeof(dst.extensionName) - 1] = '\0';
|
||||
abort();
|
||||
}
|
||||
strcpy(dst.extensionName, extensions[i]);
|
||||
}
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue