Review changes

This commit is contained in:
jpirnay
2026-05-20 20:57:42 +02:00
parent 78e1d2eacb
commit ecd20f9512
+8
View File
@@ -40,6 +40,14 @@ bool FontInstaller::isValidFontFileName(const char* name) {
if (name[0] == '/') return false;
if (strchr(name, '\\') != nullptr) return false;
if (strstr(name, "..") != nullptr) return false;
// Reject multiple slashes or trailing slash to limit directory depth
int slashCount = 0;
for (const char* p = name; *p; ++p) {
if (*p == '/') {
++slashCount;
if (slashCount > 1 || *(p + 1) == '\0' || *(p + 1) == '/') return false;
}
}
return true;
}