From 2c3febc8afc599fc6130ee117f1d04b85acac778 Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Sun, 20 Sep 2015 17:38:26 -0700 Subject: [PATCH] http: validating job is provided to avoid nil pointer --- command/agent/job_endpoint.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/command/agent/job_endpoint.go b/command/agent/job_endpoint.go index 4812ee08f..ceaa8096f 100644 --- a/command/agent/job_endpoint.go +++ b/command/agent/job_endpoint.go @@ -160,6 +160,9 @@ func (s *HTTPServer) jobUpdate(resp http.ResponseWriter, req *http.Request, if err := decodeBody(req, &args, nil); err != nil { return nil, CodedError(400, err.Error()) } + if args.Job == nil { + return nil, CodedError(400, "Job must be specified") + } if jobName != "" && args.Job.ID != jobName { return nil, CodedError(400, "Job ID does not match") }