Skip to content
Snippets Groups Projects
Commit 1f91d731 authored by swym's avatar swym
Browse files

fix(pycardium): make it work with absolute paths

Otherwise, /card10.bin would be writable :)
parent b23fb212
No related branches found
No related tags found
No related merge requests found
Pipeline #3165 passed
......@@ -10,12 +10,20 @@
#include "os.h"
bool pycrd_filename_restricted(const char *fname)
bool pycrd_filename_restricted(const char *path)
{
// files that cannot be opened in write modes
const char *const forbidden_files[] = {
"card10.bin", "menu.py", "main.py", "card10.cfg"
};
const char *fname = strchr(path, '/');
while (fname) {
path = fname + 1;
fname = strchr(path, '/');
}
fname = path;
for (int i = 0;
i < sizeof(forbidden_files) / sizeof(forbidden_files[0]);
i++) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment