fix(multisocket): cap num sockets to prevent OOM (#7615)

This commit is contained in:
Ville Vesilehto
2025-10-14 17:31:57 +03:00
committed by GitHub
parent 89bf0a2cc2
commit f085ed0e6d
3 changed files with 7 additions and 1 deletions

View File

@@ -11,6 +11,7 @@ import (
)
const pluginName = "multisocket"
const maxNumSockets = 1024
func init() { plugin.Register(pluginName, setup) }
@@ -45,6 +46,9 @@ func parseNumSockets(c *caddy.Controller) error {
if numSockets < 1 {
return fmt.Errorf("num sockets can not be zero or negative: %d", numSockets)
}
if numSockets > maxNumSockets {
return fmt.Errorf("num sockets exceeds maximum (%d): %d", maxNumSockets, numSockets)
}
config.NumSockets = numSockets
return nil