mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 03:05:07 +03:00 
			
		
		
		
	Fix panic in address.GetKey() (fixes #860)
				
					
				
			This commit is contained in:
		
							parent
							
								
									99227b60ce
								
							
						
					
					
						commit
						4859accbb0
					
				
					 1 changed files with 5 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -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]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue