netfilter: nf_tables: fix wrong length for jump/goto verdicts

NFT_JUMP/GOTO erronously sets length to sizeof(void *).

We then allocate insufficient memory when such element is added to a vmap.

Suggested-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
Florian Westphal 2015-04-14 16:44:14 +02:00 коммит произвёл Pablo Neira Ayuso
Родитель b357a364c5
Коммит 4c4ed0748f
1 изменённых файлов: 1 добавлений и 2 удалений

Просмотреть файл

@ -4340,7 +4340,6 @@ static int nft_verdict_init(const struct nft_ctx *ctx, struct nft_data *data,
case NFT_CONTINUE: case NFT_CONTINUE:
case NFT_BREAK: case NFT_BREAK:
case NFT_RETURN: case NFT_RETURN:
desc->len = sizeof(data->verdict);
break; break;
case NFT_JUMP: case NFT_JUMP:
case NFT_GOTO: case NFT_GOTO:
@ -4355,10 +4354,10 @@ static int nft_verdict_init(const struct nft_ctx *ctx, struct nft_data *data,
chain->use++; chain->use++;
data->verdict.chain = chain; data->verdict.chain = chain;
desc->len = sizeof(data);
break; break;
} }
desc->len = sizeof(data->verdict);
desc->type = NFT_DATA_VERDICT; desc->type = NFT_DATA_VERDICT;
return 0; return 0;
} }