summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFilippo Valsorda <hi@filippo.io>2018-05-20 23:38:58 -0400
committerJason A. Donenfeld <Jason@zx2c4.com>2018-05-21 20:21:31 +0200
commit7a527f7c89fe7929e2bc2c7e38be4862f24cc494 (patch)
tree302e50359164bd4283e0a2f0ea3a415a790f1b88
parent84f52ce0d690c2377b032c8fc42b591930822d7e (diff)
Fix Sscanf use in tun_darwin
License: MIT Signed-off-by: Filippo Valsorda <valsorda@google.com>
-rw-r--r--tun_darwin.go4
1 files 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]*")
}
}