aboutsummaryrefslogtreecommitdiffstats
path: root/net/netlink/genetlink.c
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2006-08-26 23:13:18 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-09-22 18:18:25 -0400
commit5176f91ea83f1a59eba4dba88634a4729d51d1ac (patch)
tree80b35d2cd7ab316f0ee96ab742fee5073b949130 /net/netlink/genetlink.c
parenta5531a5d852008be40811496029012f4ad3093d1 (diff)
[NETLINK]: Make use of NLA_STRING/NLA_NUL_STRING attribute validation
Converts existing NLA_STRING attributes to use the new validation features, saving a couple of temporary buffers. Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netlink/genetlink.c')
-rw-r--r--net/netlink/genetlink.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index d32599116c56..3ac942cdb677 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -455,7 +455,8 @@ static struct sk_buff *ctrl_build_msg(struct genl_family *family, u32 pid,
455 455
456static struct nla_policy ctrl_policy[CTRL_ATTR_MAX+1] __read_mostly = { 456static struct nla_policy ctrl_policy[CTRL_ATTR_MAX+1] __read_mostly = {
457 [CTRL_ATTR_FAMILY_ID] = { .type = NLA_U16 }, 457 [CTRL_ATTR_FAMILY_ID] = { .type = NLA_U16 },
458 [CTRL_ATTR_FAMILY_NAME] = { .type = NLA_STRING }, 458 [CTRL_ATTR_FAMILY_NAME] = { .type = NLA_NUL_STRING,
459 .len = GENL_NAMSIZ - 1 },
459}; 460};
460 461
461static int ctrl_getfamily(struct sk_buff *skb, struct genl_info *info) 462static int ctrl_getfamily(struct sk_buff *skb, struct genl_info *info)
@@ -470,12 +471,9 @@ static int ctrl_getfamily(struct sk_buff *skb, struct genl_info *info)
470 } 471 }
471 472
472 if (info->attrs[CTRL_ATTR_FAMILY_NAME]) { 473 if (info->attrs[CTRL_ATTR_FAMILY_NAME]) {
473 char name[GENL_NAMSIZ]; 474 char *name;
474
475 if (nla_strlcpy(name, info->attrs[CTRL_ATTR_FAMILY_NAME],
476 GENL_NAMSIZ) >= GENL_NAMSIZ)
477 goto errout;
478 475
476 name = nla_data(info->attrs[CTRL_ATTR_FAMILY_NAME]);
479 res = genl_family_find_byname(name); 477 res = genl_family_find_byname(name);
480 } 478 }
481 479