diff options
author | Carlos Falgueras García <carlosfg@riseup.net> | 2016-07-11 18:07:40 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2016-07-11 19:14:54 +0200 |
commit | bda7102d60bfdab2aa3f36ebd09a119206f264d0 (patch) | |
tree | b53ca0f0bc4aefa48d408276f7b62f62c5a4ede5 /src/expr/lookup.c | |
parent | 8f1e916b9856785cb835a2d550c9605e86937055 (diff) |
src: Fix nftnl_*_get_data() to return the real attribute length
All getters must set the memory size of the attributes, ie. this
includes the nul-termination in strings.
For references to opaque objects hidden behind the curtain, report
a zero size.
Signed-off-by: Carlos Falgueras García <carlosfg@riseup.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/expr/lookup.c')
-rw-r--r-- | src/expr/lookup.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/expr/lookup.c b/src/expr/lookup.c index 7f68f74..16cfce2 100644 --- a/src/expr/lookup.c +++ b/src/expr/lookup.c @@ -73,10 +73,13 @@ nftnl_expr_lookup_get(const struct nftnl_expr *e, uint16_t type, *data_len = sizeof(lookup->dreg); return &lookup->dreg; case NFTNL_EXPR_LOOKUP_SET: + *data_len = strlen(lookup->set_name) + 1; return lookup->set_name; case NFTNL_EXPR_LOOKUP_SET_ID: + *data_len = sizeof(lookup->set_id); return &lookup->set_id; case NFTNL_EXPR_LOOKUP_FLAGS: + *data_len = sizeof(lookup->flags); return &lookup->flags; } return NULL; |