Skip to contentSkip to conversation

fib: Fix out of bound access of dn_fib_props[]

DECNet Thomas Graf 2 participants 2 messages Mar 24, 2007 – Mar 25, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Fixes a typo which caused fib_props[] to have the wrong size and makes sure the value used to index the array which is provided by userspace via netlink is checked to avoid out of bound access.

net/decnet/dn_fib.c +4 -1
Index: net-2.6/net/decnet/dn_fib.c
===================================================================
@@ -63,7 +63,7 @@ static struct
 {
 	int error;
 	u8 scope;
-} dn_fib_props[RTA_MAX+1] = {
+} dn_fib_props[RTN_MAX+1] = {
 	[RTN_UNSPEC] =      { .error = 0,       .scope = RT_SCOPE_NOWHERE },
 	[RTN_UNICAST] =     { .error = 0,       .scope = RT_SCOPE_UNIVERSE },
 	[RTN_LOCAL] =       { .error = 0,       .scope = RT_SCOPE_HOST },
@@ -276,6 +276,9 @@ struct dn_fib_info *dn_fib_create_info(c
 	struct dn_fib_info *ofi;
 	int nhs = 1;
 
+	if (r->rtm_type > RTN_MAX)
+		goto err_inval;
+
 	if (dn_fib_props[r->rtm_type].scope > r->rtm_scope)
 		goto err_inval;
 
maintainer
#1 lore raw

From: Thomas Graf <[email protected]>
Date: Sat, 24 Mar 2007 16:35:13 +0100

Quoted 6 lines

Fixes a typo which caused fib_props[] to have the wrong size and makes sure the value used to index the array which is provided by userspace via netlink is checked to avoid out of bound access.

Also applied, thanks Thomas.