diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2016-10-31 13:30:31 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2016-10-31 13:31:54 +0100 |
commit | 5541b7d725ac1f25548a7fa05f6c89b69384120b (patch) | |
tree | 1de1767bd9539747fca31db01c5223c31bfc5bd9 | |
parent | a970963a2ad4411efcd7362c63f7d2e3bec5cbc2 (diff) |
expr: missing offset handling for snprintf() in hash and numgen
Fix incorrect output when offset attribute is unset.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r-- | src/expr/hash.c | 2 | ||||
-rw-r--r-- | src/expr/numgen.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/expr/hash.c b/src/expr/hash.c index c235502..83f9317 100644 --- a/src/expr/hash.c +++ b/src/expr/hash.c @@ -220,7 +220,7 @@ nftnl_expr_hash_snprintf_default(char *buf, size_t size, SNPRINTF_BUFFER_SIZE(ret, size, len, offset); if (hash->offset) { - ret = snprintf(buf, len, "offset %u ", hash->offset); + ret = snprintf(buf + offset, len, "offset %u ", hash->offset); SNPRINTF_BUFFER_SIZE(ret, size, len, offset); } diff --git a/src/expr/numgen.c b/src/expr/numgen.c index e4e055e..a15f03a 100644 --- a/src/expr/numgen.c +++ b/src/expr/numgen.c @@ -194,7 +194,7 @@ nftnl_expr_ng_snprintf_default(char *buf, size_t size, } if (ng->offset) { - ret = snprintf(buf, len, "offset %u ", ng->offset); + ret = snprintf(buf + offset, len, "offset %u ", ng->offset); SNPRINTF_BUFFER_SIZE(ret, size, len, offset); } |