mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-30 18:17:55 +00:00
Fix integer overflows with new parseutil (#15437)
* Use new parseutil helper: Safe variants Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com> * Update parseutil to v0.1.5 Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com> * Fix additional integer overflow in command/server Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/go-secure-stdlib/parseutil"
|
||||
"github.com/posener/complete"
|
||||
)
|
||||
|
||||
@@ -208,8 +209,8 @@ type IntVar struct {
|
||||
func (f *FlagSet) IntVar(i *IntVar) {
|
||||
initial := i.Default
|
||||
if v, exist := os.LookupEnv(i.EnvVar); exist {
|
||||
if i, err := strconv.ParseInt(v, 0, 64); err == nil {
|
||||
initial = int(i)
|
||||
if i, err := parseutil.SafeParseInt(v); err == nil {
|
||||
initial = i
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,7 +244,7 @@ func newIntValue(def int, target *int, hidden bool) *intValue {
|
||||
}
|
||||
|
||||
func (i *intValue) Set(s string) error {
|
||||
v, err := strconv.ParseInt(s, 0, 64)
|
||||
v, err := parseutil.SafeParseInt(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user