Skip to content

Commit

Permalink
fix: code security (#5151)
Browse files Browse the repository at this point in the history
  • Loading branch information
xuriwuyun authored Sep 18, 2023
1 parent 348fe5e commit c2bcca2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion controllers/apps/components/base_stateful.go
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ func (c *rsmComponentBase) leaveMember4ScaleIn(reqCtx intctrlutil.RequestCtx, cl
}
for _, pod := range pods {
subs := strings.Split(pod.Name, "-")
if ordinal, err := strconv.Atoi(subs[len(subs)-1]); err != nil {
if ordinal, err := strconv.ParseInt(subs[len(subs)-1], 10, 32); err != nil {
return err
} else if int32(ordinal) < c.Component.Replicas {
continue
Expand Down
6 changes: 3 additions & 3 deletions lorry/component/kafka/thirdparty/retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func decodeString(f reflect.Type, t reflect.Type, data any) (any, error) {

switch t.Kind() {
case reflect.Uint:
val, err := strconv.ParseUint(dataString, 10, 64)
val, err := strconv.ParseUint(dataString, 10, 32)

return uint(val), invalidError(err, "uint", dataString)
case reflect.Uint64:
Expand All @@ -253,9 +253,9 @@ func decodeString(f reflect.Type, t reflect.Type, data any) (any, error) {
return uint8(val), invalidError(err, "uint8", dataString)

case reflect.Int:
val, err := strconv.ParseInt(dataString, 10, 64)
val, err := strconv.Atoi(dataString)

return int(val), invalidError(err, "int", dataString)
return val, invalidError(err, "int", dataString)
case reflect.Int64:
val, err := strconv.ParseInt(dataString, 10, 64)

Expand Down

0 comments on commit c2bcca2

Please sign in to comment.