summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorBen Davis <ben.davis@arm.com>2021-09-15 10:08:15 +0100
committerBen Davis <ben.davis@arm.com>2021-10-11 17:31:57 +0000
commite00a2d8e40707e50050a3c5bf278fa7441065ec5 (patch)
treecf6cf5e6805a55bfb95f2faf673e6973e96c5578 /util
parentbed55ba330c30680916edb2ec852a12ea90cb566 (diff)
downloadvulkan-wsi-layer-e00a2d8e40707e50050a3c5bf278fa7441065ec5.tar.gz
vulkan-wsi-layer-e00a2d8e40707e50050a3c5bf278fa7441065ec5.tar.bz2
vulkan-wsi-layer-e00a2d8e40707e50050a3c5bf278fa7441065ec5.zip
Fix issues found by static analysis
Change-Id: I222ec3b352aa220b6c08df3a71de48178b67f06d Signed-off-by: Ben Davis <ben.davis@arm.com>
Diffstat (limited to 'util')
-rw-r--r--util/custom_allocator.hpp6
-rw-r--r--util/extension_list.cpp5
2 files changed, 8 insertions, 3 deletions
diff --git a/util/custom_allocator.hpp b/util/custom_allocator.hpp
index bb6a7a0..486fd18 100644
--- a/util/custom_allocator.hpp
+++ b/util/custom_allocator.hpp
@@ -316,7 +316,7 @@ public:
base::push_back(std::forward<arg_types>(args)...);
return true;
}
- catch (const std::bad_alloc &e)
+ catch (const std::bad_alloc &)
{
return false;
}
@@ -348,11 +348,11 @@ public:
base::resize(std::forward<arg_types>(args)...);
return true;
}
- catch (const std::bad_alloc &e)
+ catch (const std::bad_alloc &)
{
return false;
}
}
};
-} /* namespace util */ \ No newline at end of file
+} /* namespace util */
diff --git a/util/extension_list.cpp b/util/extension_list.cpp
index a3e672b..4194404 100644
--- a/util/extension_list.cpp
+++ b/util/extension_list.cpp
@@ -48,6 +48,11 @@ VkResult extension_list::add(const char *const *extensions, uint32_t count)
{
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';
+ }
}
return VK_SUCCESS;
}