summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2018-04-03 13:03:39 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2018-04-03 13:22:44 +0200
commit440ea91fbcc9d7d7f50ec12cb65b68ce58a7c5f5 (patch)
tree47ff3648b5efd36610b06d4d0374e1a454f911b5
parent715c8e7b625a48d3a64d9d2a7f83e33e458b1355 (diff)
netlink: floating point exception with concatenations
If the length is less than 1 byte, this codepath hits a floating point exception, use div_round_up() as everywhere else in the code. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--src/netlink.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/netlink.c b/src/netlink.c
index bfa30502..00fac11d 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -371,7 +371,7 @@ static void netlink_gen_concat_data(const struct expr *expr,
list_for_each_entry(i, &expr->expressions, list) {
assert(i->ops->type == EXPR_VALUE);
mpz_export_data(data + offset, i->value, i->byteorder,
- i->len / BITS_PER_BYTE);
+ div_round_up(i->len, BITS_PER_BYTE));
offset += netlink_padded_len(i->len) / BITS_PER_BYTE;
}