[PATCH] Fix transport message length check

Jason A. Donenfeld Jason at zx2c4.com
Tue Sep 25 05:20:43 CEST 2018


Hey Chris,

On 9/20/18 2:28 PM, Chris Branch wrote:
> wireguard-go has a bad length check in its transport message handling.
> Although it cannot be exploited because of another length check earlier in the
> function, this should be fixed regardless.
> 
> ---
>   receive.go | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/receive.go b/receive.go
> index 6b6543c..cbc3fd1 100644
> --- a/receive.go
> +++ b/receive.go
> @@ -146,7 +146,7 @@ func (device *Device) RoutineReceiveIncoming(IP int, bind Bind) {
>   
>   			// check size
>   
> -			if len(packet) < MessageTransportType {
> +			if len(packet) < MessageTransportSize {
>   				continue
>   			}
>   
> 


Nice catch! Fixed in master. I'll probably have a new snapshot out not 
before too long.

Jason


More information about the WireGuard mailing list