mirror of
https://github.com/hyprwm/hyprcursor.git
synced 2025-12-25 22:50:03 +01:00
Validate cursor directory names
This commit is contained in:
parent
691a5a2f1c
commit
2d5b9d1278
1 changed files with 4 additions and 0 deletions
|
|
@ -5,6 +5,7 @@
|
|||
#include <array>
|
||||
#include <format>
|
||||
#include <algorithm>
|
||||
#include <regex>
|
||||
#include <hyprlang.hpp>
|
||||
#include "internalSharedTypes.hpp"
|
||||
#include "manifest.hpp"
|
||||
|
|
@ -98,6 +99,9 @@ static std::optional<std::string> createCursorThemeFromPath(const std::string& p
|
|||
// iterate over the directory and record all cursors
|
||||
|
||||
for (auto& dir : std::filesystem::directory_iterator(CURSORDIR)) {
|
||||
if (!std::regex_match(dir.path().stem().string(), std::regex("^[A-Za-z0-9_\\-\\.]+$")))
|
||||
return "Invalid cursor directory name at " + dir.path().string() + " : characters must be within [A-Za-z0-9_\\-\\.]";
|
||||
|
||||
const auto METAPATH = dir.path().string() + "/meta";
|
||||
|
||||
auto& SHAPE = currentTheme.shapes.emplace_back(std::make_unique<SCursorShape>());
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue