From fba0d6dc6add53170b374e0637ef32474afc9e30 Mon Sep 17 00:00:00 2001 From: Drew Bailey <2614075+drewbailey@users.noreply.github.com> Date: Thu, 15 Oct 2020 16:34:33 -0400 Subject: [PATCH] event buffer size and durable count must be non negative --- command/agent/agent.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/command/agent/agent.go b/command/agent/agent.go index e9d9f882b..1605fc086 100644 --- a/command/agent/agent.go +++ b/command/agent/agent.go @@ -247,9 +247,15 @@ func convertServerConfig(agentConfig *Config) (*nomad.Config, error) { conf.EnableEventBroker = *agentConfig.Server.EnableEventBroker } if agentConfig.Server.EventBufferSize != nil { + if *agentConfig.Server.EventBufferSize < 0 { + return nil, fmt.Errorf("Invalid Config, event_buffer_size must be non-negative") + } conf.EventBufferSize = int64(*agentConfig.Server.EventBufferSize) } if agentConfig.Server.DurableEventCount != nil { + if *agentConfig.Server.DurableEventCount < 0 { + return nil, fmt.Errorf("Invalid Config, durable_event_count must be non-negative") + } conf.DurableEventCount = int64(*agentConfig.Server.DurableEventCount) } if agentConfig.Autopilot != nil {