]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
Fix Sscanf use in tun_darwin
authorFilippo Valsorda <hi@filippo.io>
Mon, 21 May 2018 03:38:58 +0000 (23:38 -0400)
committerJason A. Donenfeld <Jason@zx2c4.com>
Mon, 21 May 2018 18:21:31 +0000 (20:21 +0200)
License: MIT
Signed-off-by: Filippo Valsorda <valsorda@google.com>
tun_darwin.go

index ef84967bb93bcc954a86452e6655395edf64495c..772f31114f99744f9c0e879cd2e8dc6eb741e64b 100644 (file)
@@ -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]*")
                }
        }