Fix Sscanf use in tun_darwin
License: MIT Signed-off-by: Filippo Valsorda <valsorda@google.com>
This commit is contained in:
parent
84f52ce0d6
commit
7a527f7c89
|
@ -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]*")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue