Skip to content

Commit

Permalink
Fix code scanning alert no. 9: Incorrect conversion between integer t…
Browse files Browse the repository at this point in the history
…ypes

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
  • Loading branch information
1 parent ce5561f commit aafd7ae
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions z/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"strconv"
"strings"
"time"
"math"

"github.com/pkg/errors"
)
Expand Down Expand Up @@ -188,6 +189,9 @@ func (sf *SuperFlag) GetDuration(opt string) time.Duration {
if err != nil {
return time.Duration(0)
}
if days > math.MaxInt64 {
return time.Duration(0)
}
return time.Hour * 24 * time.Duration(days)
}
d, err := time.ParseDuration(val)
Expand Down

0 comments on commit aafd7ae

Please sign in to comment.