Thread (4 messages) flat view 4 messages, 3 authors, 2016-10-17

Re: [patch] netfilter: nf_tables: underflow in nft_parse_u32_check()

From: Liping Zhang <hidden>
Date: 2016-10-12 07:27:19
Also in: kernel-janitors, netfilter-devel

2016-10-12 14:08 GMT+08:00 Dan Carpenter [off-list ref]:
quoted hunk ↗ jump to hunk
We don't want to allow negatives here.

Fixes: 36b701fae12a ('netfilter: nf_tables: validate maximum value of u32 netlink attributes')
Signed-off-by: Dan Carpenter <redacted>
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index b70d3ea..dd55187 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -4423,7 +4423,7 @@ static int nf_tables_check_loops(const struct nft_ctx *ctx,
  */
I think it's better if you can convert it to follows:
 unsigned int nft_parse_u32_check(const struct nlattr *attr, int max, u32 *dest)
int nft_parse_u32_check(const struct nlattr *attr, u32 max, u32 *dest)
 {
-       int val;
+       uint val;
            u32 val;
        val = ntohl(nla_get_be32(attr));
        if (val > max)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help