mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-10-15 20:13:59 +00:00
lua: prevent configuration files from being executed as scripts
This commit is contained in:
Vendored
+8
-2
@@ -13,6 +13,7 @@ import (
|
||||
|
||||
"github.com/xtls/xray-core/common/buf"
|
||||
"github.com/xtls/xray-core/common/errors"
|
||||
"github.com/xtls/xray-core/common/platform"
|
||||
"github.com/xtls/xray-core/common/utils"
|
||||
"github.com/xtls/xray-core/main/confloader"
|
||||
)
|
||||
@@ -28,10 +29,15 @@ func ConfigLoader(arg string) (out io.Reader, err error) {
|
||||
data, err = FetchHTTPContent(arg)
|
||||
|
||||
case arg == "stdin:":
|
||||
data, err = io.ReadAll(os.Stdin)
|
||||
data, err = platform.ReadConfigFile(os.Stdin)
|
||||
|
||||
default:
|
||||
data, err = os.ReadFile(arg)
|
||||
file, openErr := os.Open(arg)
|
||||
if openErr != nil {
|
||||
return nil, openErr
|
||||
}
|
||||
defer file.Close()
|
||||
data, err = platform.ReadConfigFile(file)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user