Skip to content

Commit

Permalink
Fixed occasional failures due to ServerName ending in period.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff R. Allen committed Feb 15, 2018
1 parent 50f7876 commit a303ac7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions network/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,5 +401,10 @@ const nonceSize = 256 / 8
func mkNonce(s Suite) []byte {
var buf [nonceSize]byte
random.Bytes(buf[:], s.RandomStream())
// In order for the nonce to safely pass through cfg.ServerName,
// it needs to avoid the characters , [ ] and %.
for bytes.ContainsAny(buf[:], ".[]%") {
random.Bytes(buf[:], s.RandomStream())
}
return buf[:]
}

0 comments on commit a303ac7

Please sign in to comment.