Skip to content

Commit 000a084

Browse files
committed
审计修复第五轮: 二次审计发现的注释修正
- hash.go: 更新过时注释(不再引用已消除的 global sumBuffer) - hash.go: 拼写修复 hashLenthRange → hashLengthRange
1 parent c54cc2c commit 000a084

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

hash.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ func addGarbleToHash(inputHash []byte) [sha256.Size]byte {
111111
// separate the env vars and flags, to reduce the chances of collisions.
112112
fmt.Fprintf(hasher, " GOGARBLE=%s", sharedCache.GOGARBLE)
113113
appendFlags(hasher, true)
114-
// addGarbleToHash returns the sum buffer, so we need a new copy.
115-
// Otherwise the next use of the global sumBuffer would conflict.
114+
// addGarbleToHash returns the sum buffer, so we use a local copy
115+
// to avoid any potential conflicts across callers.
116116
var sumBuffer [sha256.Size]byte
117117
hasher.Sum(sumBuffer[:0])
118118
return sumBuffer
@@ -332,7 +332,7 @@ func hashWithCustomSalt(salt []byte, name string) string {
332332
// The byte after neededSumBytes is never used as part of the name,
333333
// but it is still deterministic and hard to predict,
334334
// so it provides us with useful randomness between 0 and 255.
335-
// We want the number to be between 0 and hashLenthRange-1 as well,
335+
// We want the number to be between 0 and hashLengthRange-1 as well,
336336
// so we use a remainder operation.
337337
hashLengthRandomness := sum[neededSumBytes] % ((maxHashLength - minHashLength) + 1)
338338
hashLength := minHashLength + hashLengthRandomness

0 commit comments

Comments
 (0)