Browse Source

ip_tunnel: Fix off-by-one error in forming dev name.

As Ben pointed out following patch fixes bug in checking device
name length limits while forming tunnel device name.

CC: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Pravin B Shelar 12 years ago
parent
commit
54a5d38289
1 changed files with 1 additions and 1 deletions
  1. 1 1
      net/ipv4/ip_tunnel.c

+ 1 - 1
net/ipv4/ip_tunnel.c

@@ -284,7 +284,7 @@ static struct net_device *__ip_tunnel_create(struct net *net,
 	if (parms->name[0])
 		strlcpy(name, parms->name, IFNAMSIZ);
 	else {
-		if (strlen(ops->kind) + 3 >= IFNAMSIZ) {
+		if (strlen(ops->kind) > (IFNAMSIZ - 3)) {
 			err = -E2BIG;
 			goto failed;
 		}