按源保护 PythonPlugin 路径列表边界
This commit is contained in:
@@ -93,6 +93,8 @@ grep -F 'return vsnprintf(buffer, size, fmt, args);' \
|
||||
grep -F 'class PythonPlugin' "$linuxcnc_root/src/emc/pythonplugin/python_plugin.hh" >/dev/null
|
||||
grep -F 'PLUGIN_PYTHON_NOT_INITIALIZED = -12,' "$linuxcnc_root/src/emc/pythonplugin/python_plugin.hh" >/dev/null
|
||||
grep -F 'PLUGIN_BAD_PATH = -5,' "$linuxcnc_root/src/emc/pythonplugin/python_plugin.hh" >/dev/null
|
||||
grep -F 'PLUGIN_EXCEPTION_DURING_PATH_PREPEND = -9,' "$linuxcnc_root/src/emc/pythonplugin/python_plugin.hh" >/dev/null
|
||||
grep -F 'PLUGIN_EXCEPTION_DURING_PATH_APPEND = -10,' "$linuxcnc_root/src/emc/pythonplugin/python_plugin.hh" >/dev/null
|
||||
grep -F 'PLUGIN_NO_CALLABLE = 1,' "$linuxcnc_root/src/emc/pythonplugin/python_plugin.hh" >/dev/null
|
||||
grep -F 'PLUGIN_EXCEPTION = 2' "$linuxcnc_root/src/emc/pythonplugin/python_plugin.hh" >/dev/null
|
||||
grep -F 'PythonPlugin::instantiate' "$linuxcnc_root/src/emc/pythonplugin/python_plugin.cc" >/dev/null
|
||||
@@ -102,6 +104,17 @@ grep -F 'if (auto inistring = inifile.findString("TOPLEVEL", section)) {' \
|
||||
grep -F 'if (realpath(toplevel, real_path) == NULL) {' \
|
||||
"$linuxcnc_root/src/emc/pythonplugin/python_plugin.cc" >/dev/null
|
||||
grep -F 'status = PLUGIN_BAD_PATH;' "$linuxcnc_root/src/emc/pythonplugin/python_plugin.cc" >/dev/null
|
||||
grep -F 'while (auto inistring = inifile.findString(n, "PATH_PREPEND", "PYTHON")) {' \
|
||||
"$linuxcnc_root/src/emc/pythonplugin/python_plugin.cc" >/dev/null
|
||||
grep -F 'while (auto inistring = inifile.findString(n, "PATH_APPEND", "PYTHON")) {' \
|
||||
"$linuxcnc_root/src/emc/pythonplugin/python_plugin.cc" >/dev/null
|
||||
grep -F 'status = PLUGIN_EXCEPTION_DURING_PATH_PREPEND;' \
|
||||
"$linuxcnc_root/src/emc/pythonplugin/python_plugin.cc" >/dev/null
|
||||
grep -F 'status = PLUGIN_EXCEPTION_DURING_PATH_APPEND;' \
|
||||
"$linuxcnc_root/src/emc/pythonplugin/python_plugin.cc" >/dev/null
|
||||
grep -F 'int IniFile::tildeExpand(const std::string &path, std::string &result)' \
|
||||
"$linuxcnc_root/src/emc/ini/inifile.cc" >/dev/null
|
||||
grep -F "if(!home)" "$linuxcnc_root/src/emc/ini/inifile.cc" >/dev/null
|
||||
grep -F 'retval = bp::exec_file(cmd, main_namespace, main_namespace);' \
|
||||
"$linuxcnc_root/src/emc/pythonplugin/python_plugin.cc" >/dev/null
|
||||
grep -F 'retval = bp::exec(cmd, main_namespace, main_namespace);' \
|
||||
@@ -195,6 +208,7 @@ expected_shims = {
|
||||
"core/wasm_shims/pythonplugin/python_plugin.cc": [
|
||||
"src/emc/pythonplugin/python_plugin.cc",
|
||||
"src/emc/pythonplugin/python_plugin.hh",
|
||||
"src/emc/ini/inifile.cc",
|
||||
],
|
||||
}
|
||||
if shim_paths != list(expected_shims):
|
||||
@@ -326,6 +340,10 @@ for needle in [
|
||||
'find_ini_value(iniFilename, section, "TOPLEVEL", toplevel)',
|
||||
"realpath(toplevel.c_str(), resolved_path) == nullptr",
|
||||
"status = PLUGIN_BAD_PATH;",
|
||||
'check_python_path_entries(iniFilename,',
|
||||
"PLUGIN_EXCEPTION_DURING_PATH_PREPEND",
|
||||
"PLUGIN_EXCEPTION_DURING_PATH_APPEND",
|
||||
"tilde_expand_path(entry, expanded)",
|
||||
"status = PLUGIN_PYTHON_NOT_INITIALIZED;",
|
||||
"return PLUGIN_NO_CALLABLE;",
|
||||
"status = PLUGIN_EXCEPTION;",
|
||||
@@ -337,6 +355,8 @@ for needle in [
|
||||
"PLUGIN_NO_SECTION",
|
||||
"PLUGIN_BAD_INIFILE",
|
||||
"PLUGIN_BAD_PATH",
|
||||
"PLUGIN_EXCEPTION_DURING_PATH_PREPEND",
|
||||
"PLUGIN_EXCEPTION_DURING_PATH_APPEND",
|
||||
"PLUGIN_PYTHON_NOT_INITIALIZED",
|
||||
"PLUGIN_NO_CALLABLE",
|
||||
"PLUGIN_EXCEPTION",
|
||||
@@ -418,6 +438,7 @@ for phrase in [
|
||||
"inactive-DB return values",
|
||||
"negative-status short-circuit behavior",
|
||||
"preserve the `TOPLEVEL` missing-path `PLUGIN_BAD_PATH` edge",
|
||||
"preserve `PATH_PREPEND` and `PATH_APPEND` tilde-expansion failure statuses",
|
||||
"LinuxCNC `rcs_print_error` split entry points",
|
||||
"without native print routing",
|
||||
"LinuxCNC userspace `rtapi_snprintf()` formatting",
|
||||
|
||||
Reference in New Issue
Block a user