fix: resolve gosec integer overflow and unconvert issues
- Fix G115 integer overflow by converting uint32 to int comparison - Remove unnecessary int() conversions for syscall constants - syscall.Stdin/Stderr/Stdout are already int type
This commit is contained in:
@@ -308,7 +308,7 @@ func DeriveBase64Password(masterKey *hdkeychain.ExtendedKey, pwdLen, index uint3
|
||||
encodedStr = strings.TrimRight(encodedStr, "=")
|
||||
|
||||
// Slice to the desired password length
|
||||
if uint32(len(encodedStr)) < pwdLen {
|
||||
if len(encodedStr) < int(pwdLen) {
|
||||
return "", fmt.Errorf("derived password length %d is shorter than requested length %d", len(encodedStr), pwdLen)
|
||||
}
|
||||
|
||||
@@ -332,7 +332,7 @@ func DeriveBase85Password(masterKey *hdkeychain.ExtendedKey, pwdLen, index uint3
|
||||
encoded := encodeBase85WithRFC1924Charset(entropy)
|
||||
|
||||
// Slice to the desired password length
|
||||
if uint32(len(encoded)) < pwdLen {
|
||||
if len(encoded) < int(pwdLen) {
|
||||
return "", fmt.Errorf("encoded length %d is less than requested length %d", len(encoded), pwdLen)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user