5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-09-19 00:59:37 +00:00

Merge pull request #861 from yggdrasil-network/fix860

Fix panic in `address.GetKey()`
This commit is contained in:
Arceliar 2021-11-02 17:30:50 -05:00 committed by GitHub
commit feb02c485a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -129,7 +129,11 @@ func (a *Address) GetKey() ed25519.PublicKey {
bits <<= byte(idx % 8)
keyIdx := keyOffset + (idx - addrOffset)
bits >>= byte(keyIdx % 8)
key[keyIdx/8] |= bits
idx := keyIdx / 8
if idx >= len(key) {
break
}
key[idx] |= bits
}
for idx := range key {
key[idx] = ^key[idx]