mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-22 16:48:23 +01:00
limit maxptysize
This commit is contained in:
parent
39dacb988a
commit
57b54198e5
@ -279,3 +279,13 @@ func BoundInt(ival int, minVal int, maxVal int) int {
|
|||||||
}
|
}
|
||||||
return ival
|
return ival
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func BoundInt64(ival int64, minVal int64, maxVal int64) int64 {
|
||||||
|
if ival < minVal {
|
||||||
|
return minVal
|
||||||
|
}
|
||||||
|
if ival > maxVal {
|
||||||
|
return maxVal
|
||||||
|
}
|
||||||
|
return ival
|
||||||
|
}
|
||||||
|
@ -40,6 +40,8 @@ const MaxFdNum = 1023
|
|||||||
const FirstExtraFilesFdNum = 3
|
const FirstExtraFilesFdNum = 3
|
||||||
const DefaultTermType = "xterm-256color"
|
const DefaultTermType = "xterm-256color"
|
||||||
const DefaultMaxPtySize = 1024 * 1024
|
const DefaultMaxPtySize = 1024 * 1024
|
||||||
|
const MinMaxPtySize = 16 * 1024
|
||||||
|
const MaxMaxPtySize = 100 * 1024 * 1024
|
||||||
|
|
||||||
const GetStateTimeout = 5 * time.Second
|
const GetStateTimeout = 5 * time.Second
|
||||||
|
|
||||||
@ -1038,10 +1040,9 @@ func RunCommandDetached(pk *packet.RunPacketType, sender *packet.PacketSender) (
|
|||||||
cmd.FileNames = fileNames
|
cmd.FileNames = fileNames
|
||||||
cmd.CmdPty = cmdPty
|
cmd.CmdPty = cmdPty
|
||||||
cmd.Detached = true
|
cmd.Detached = true
|
||||||
if pk.TermOpts != nil && pk.TermOpts.MaxPtySize != 0 {
|
cmd.MaxPtySize = DefaultMaxPtySize
|
||||||
cmd.MaxPtySize = pk.TermOpts.MaxPtySize
|
if pk.TermOpts != nil && pk.TermOpts.MaxPtySize > 0 {
|
||||||
} else {
|
cmd.MaxPtySize = base.BoundInt64(pk.TermOpts.MaxPtySize, MinMaxPtySize, MaxMaxPtySize)
|
||||||
cmd.MaxPtySize = DefaultMaxPtySize
|
|
||||||
}
|
}
|
||||||
cmd.RunnerOutFd, err = os.OpenFile(fileNames.RunnerOutFile, os.O_TRUNC|os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0600)
|
cmd.RunnerOutFd, err = os.OpenFile(fileNames.RunnerOutFile, os.O_TRUNC|os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user