mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 11:15:07 +03:00 
			
		
		
		
	Fix panic where slice goes out of bounds because iface.Read returns less than zero (which might happen when the TUN/TAP interface is closed)
This commit is contained in:
		
							parent
							
								
									368f499f1d
								
							
						
					
					
						commit
						94cf2854a9
					
				
					 1 changed files with 1 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -111,7 +111,7 @@ func (r *tunReader) _read() {
 | 
			
		|||
	recvd := util.ResizeBytes(util.GetBytes(), 65535+tun_ETHER_HEADER_LENGTH)
 | 
			
		||||
	// Wait for a packet to be delivered to us through the TUN/TAP adapter
 | 
			
		||||
	n, err := r.tun.iface.Read(recvd)
 | 
			
		||||
	if n == 0 {
 | 
			
		||||
	if n <= 0 {
 | 
			
		||||
		util.PutBytes(recvd)
 | 
			
		||||
	} else {
 | 
			
		||||
		r.tun.handlePacketFrom(r, recvd[:n], err)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue