mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
jailed exec: prevent imports
This commit is contained in:
parent
b77463f5b2
commit
49b4436c86
@ -69,6 +69,10 @@ int load_module_from_dll_desktop_only(const char* path) PY_RAISE PY_RETURN;
|
|||||||
|
|
||||||
int py_import(const char* path_cstr) {
|
int py_import(const char* path_cstr) {
|
||||||
VM* vm = pk_current_vm;
|
VM* vm = pk_current_vm;
|
||||||
|
if (vm->max_steps > 0) {
|
||||||
|
ImportError("not allowed in safe context");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
c11_sv path = {path_cstr, strlen(path_cstr)};
|
c11_sv path = {path_cstr, strlen(path_cstr)};
|
||||||
if(path.size == 0) return ValueError("empty module name");
|
if(path.size == 0) return ValueError("empty module name");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user