From 36b436b2b7afa3772d511c5d2980fe6e36e08bcb Mon Sep 17 00:00:00 2001 From: Matthew Hooker Date: Fri, 13 Jan 2017 14:22:25 -0800 Subject: [PATCH] make port range inclusive --- common/step_http_server.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/step_http_server.go b/common/step_http_server.go index 55874992e..bb97b9eac 100644 --- a/common/step_http_server.go +++ b/common/step_http_server.go @@ -45,7 +45,8 @@ func (s *StepHTTPServer) Run(state multistep.StateBag) multistep.StepAction { if portRange > 0 { // Intn will panic if portRange == 0, so we do a check. - offset = uint(rand.Intn(portRange)) + // Intn is from [0, n), so add 1 to make from [0, n] + offset = uint(rand.Intn(portRange + 1)) } httpPort = offset + s.HTTPPortMin