From 7a527f7c89fe7929e2bc2c7e38be4862f24cc494 Mon Sep 17 00:00:00 2001 From: Filippo Valsorda Date: Sun, 20 May 2018 23:38:58 -0400 Subject: [PATCH] Fix Sscanf use in tun_darwin License: MIT Signed-off-by: Filippo Valsorda --- tun_darwin.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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]*") } }