X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=inline;f=datapath%2Fbrc_procfs.c;h=36659482a0232cbf6d608c3397c69d5ac4215055;hb=37a1300c3ca05a97160d44dc34298c447b50ed9d;hp=6bcb51c2412bf44e348eabc1ab080512e58625fc;hpb=84c17d988c287619e356921f60e4033fa80cd9cd;p=openvswitch diff --git a/datapath/brc_procfs.c b/datapath/brc_procfs.c index 6bcb51c2..36659482 100644 --- a/datapath/brc_procfs.c +++ b/datapath/brc_procfs.c @@ -81,13 +81,6 @@ static struct proc_dir_entry *brc_open_dir(const char *dir_name, return *dirp; } -/* Maximum length of the BRC_GENL_A_PROC_DIR and BRC_GENL_A_PROC_NAME strings. - * If we could depend on supporting NLA_NUL_STRING and the .len member in - * Generic Netlink policy, then we could just put this in brc_genl_policy (and - * simplify brc_genl_set_proc() below too), but upstream 2.6.18 does not have - * either. */ -#define BRC_NAME_LEN_MAX 32 - int brc_genl_set_proc(struct sk_buff *skb, struct genl_info *info) { struct proc_dir_entry *dir, *entry; @@ -95,18 +88,15 @@ int brc_genl_set_proc(struct sk_buff *skb, struct genl_info *info) char *data; if (!info->attrs[BRC_GENL_A_PROC_DIR] || - VERIFY_NUL_STRING(info->attrs[BRC_GENL_A_PROC_DIR]) || + VERIFY_NUL_STRING(info->attrs[BRC_GENL_A_PROC_DIR], BRC_NAME_LEN_MAX) || !info->attrs[BRC_GENL_A_PROC_NAME] || - VERIFY_NUL_STRING(info->attrs[BRC_GENL_A_PROC_NAME]) || + VERIFY_NUL_STRING(info->attrs[BRC_GENL_A_PROC_NAME], BRC_NAME_LEN_MAX) || (info->attrs[BRC_GENL_A_PROC_DATA] && - VERIFY_NUL_STRING(info->attrs[BRC_GENL_A_PROC_DATA]))) + VERIFY_NUL_STRING(info->attrs[BRC_GENL_A_PROC_DATA], INT_MAX))) return -EINVAL; dir_name = nla_data(info->attrs[BRC_GENL_A_PROC_DIR]); name = nla_data(info->attrs[BRC_GENL_A_PROC_NAME]); - if (strlen(dir_name) > BRC_NAME_LEN_MAX || - strlen(name) > BRC_NAME_LEN_MAX) - return -EINVAL; if (!strcmp(dir_name, "net/vlan")) dir = brc_open_dir("vlan", proc_net, &proc_vlan_dir);