diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2024-02-03 11:10:24 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-03 11:10:24 -0500 |
commit | 81cc4df1f9a511d86b52acbb4e3df2f5e36f83f8 (patch) | |
tree | 09c5d5a938c235529e9debcd9a218e5a419282e8 /src/common/hex_util.h | |
parent | 25f3d358b12a7108adb8e19fb263dbcd796324a5 (diff) | |
parent | fb3ef957bbb6d674f7482572443a678e6b4a612e (diff) |
Merge pull request #12895 from german77/files
service: fs: Skip non user id folders
Diffstat (limited to 'src/common/hex_util.h')
-rw-r--r-- | src/common/hex_util.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/common/hex_util.h b/src/common/hex_util.h index a00904939..618f53152 100644 --- a/src/common/hex_util.h +++ b/src/common/hex_util.h @@ -9,6 +9,7 @@ #include <string> #include <vector> #include <fmt/format.h> +#include "common/assert.h" #include "common/common_types.h" namespace Common { @@ -29,6 +30,8 @@ namespace Common { template <std::size_t Size, bool le = false> [[nodiscard]] constexpr std::array<u8, Size> HexStringToArray(std::string_view str) { + ASSERT_MSG(Size * 2 <= str.size(), "Invalid string size"); + std::array<u8, Size> out{}; if constexpr (le) { for (std::size_t i = 2 * Size - 2; i <= 2 * Size; i -= 2) { |