rpc: fix ExpandHome restrictions bypass (#667)

`go-home` seems to be using environment variables first
This commit is contained in:
Tomas Tauber
2021-10-13 10:52:05 +00:00
committed by GitHub
parent 4ead9814cc
commit 8e12d94359
5 changed files with 31 additions and 14 deletions
+6 -1
View File
@@ -223,7 +223,12 @@ func startInProcess(ctx *server.Context, clientCtx client.Context, appCreator ty
var cpuProfileCleanup func()
if cpuProfile := ctx.Viper.GetString(srvflags.CPUProfile); cpuProfile != "" {
f, err := os.Create(ethdebug.ExpandHome(cpuProfile))
fp, err := ethdebug.ExpandHome(cpuProfile)
if err != nil {
ctx.Logger.Debug("failed to get filepath for the CPU profile file", "error", err.Error())
return err
}
f, err := os.Create(fp)
if err != nil {
return err
}