From: Filippo Valsorda Date: Mon, 21 May 2018 03:38:58 +0000 (-0400) Subject: Fix Sscanf use in tun_darwin X-Git-Tag: 0.0.20180524~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a527f7c89fe7929e2bc2c7e38be4862f24cc494;p=thirdparty%2Fwireguard-go.git Fix Sscanf use in tun_darwin License: MIT Signed-off-by: Filippo Valsorda --- diff --git a/tun_darwin.go b/tun_darwin.go index ef84967..772f311 100644 --- a/tun_darwin.go +++ b/tun_darwin.go @@ -100,8 +100,8 @@ func (tun *NativeTun) RoutineRouteListener(tunIfindex int) { func CreateTUN(name string) (TUNDevice, error) { ifIndex := -1 if name != "utun" { - fmt.Sscanf(name, "utun%d", &ifIndex) - if ifIndex < 0 { + _, err := fmt.Sscanf(name, "utun%d", &ifIndex) + if err != nil || ifIndex < 0 { return nil, fmt.Errorf("Interface name must be utun[0-9]*") } }