Skip to content

Commit

Permalink
Follow up, Fix Integer Overflow
Browse files Browse the repository at this point in the history
that were identified by the new GolangCILint subversion v1.60.3.
  • Loading branch information
mpass99 authored and MrSerth committed Sep 2, 2024
1 parent d448dd8 commit 35bbae7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/runner/nomad_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"errors"
"fmt"
"io"
"math"
"net/http"
"strings"
"time"
Expand Down Expand Up @@ -299,8 +300,11 @@ func (r *NomadJob) executeCommand(ctx context.Context, command string, privilege
stdin io.ReadWriter, stdout, stderr io.Writer, exit chan<- ExitInfo,
) {
exitCode, err := r.api.ExecuteCommand(ctx, r.id, command, true, privilegedExecution, stdin, stdout, stderr)
if exitCode > math.MaxUint8 {
log.WithContext(ctx).WithError(err).WithField("exit_code", exitCode).Error("exitCode too big")
}
select {
case exit <- ExitInfo{uint8(exitCode), err}:
case exit <- ExitInfo{uint8(exitCode), err}: //nolint:gosec // We check for an integer overflow right above.
case <-ctx.Done():
}
}
Expand Down

0 comments on commit 35bbae7

Please sign in to comment.