diff options
Diffstat (limited to 'src/datatype.c')
-rw-r--r-- | src/datatype.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/datatype.c b/src/datatype.c index 82a77537..f42e3dfb 100644 --- a/src/datatype.c +++ b/src/datatype.c @@ -23,6 +23,7 @@ #include <expression.h> #include <gmputil.h> #include <erec.h> +#include <netlink.h> #include <netinet/ip_icmp.h> #include <netinet/icmp6.h> @@ -938,7 +939,7 @@ const struct datatype *concat_type_alloc(uint32_t type) unsigned int size = 0, subtypes = 0, n; n = div_round_up(fls(type), TYPE_BITS); - while (concat_subtype_id(type, --n)) { + while (n > 0 && concat_subtype_id(type, --n)) { i = concat_subtype_lookup(type, n); if (i == NULL) return NULL; @@ -950,7 +951,7 @@ const struct datatype *concat_type_alloc(uint32_t type) strncat(desc, i->desc, sizeof(desc) - strlen(desc) - 1); strncat(name, i->name, sizeof(name) - strlen(name) - 1); - size += i->size; + size += netlink_padded_len(i->size); subtypes++; } strncat(desc, ")", sizeof(desc) - strlen(desc) - 1); |