mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 00:04:15 -04:00
fix(multisocket): cap num sockets to prevent OOM (#7615)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user