From a0e52b23ba47791537e30c3f256ae7b7d1374090 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 8 Apr 2015 12:53:50 +0200 Subject: [PATCH] sd-rtnl: properly size attribute array if IFA_FLAGS was missing --- src/libelogind/sd-rtnl/rtnl-types.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libelogind/sd-rtnl/rtnl-types.c b/src/libelogind/sd-rtnl/rtnl-types.c index 3916b0bd6..792c5327d 100644 --- a/src/libelogind/sd-rtnl/rtnl-types.c +++ b/src/libelogind/sd-rtnl/rtnl-types.c @@ -372,7 +372,9 @@ static const NLTypeSystem rtnl_link_type_system = { .types = rtnl_link_types, }; -static const NLType rtnl_address_types[IFA_MAX + 1] = { +/* IFA_FLAGS was defined in kernel 3.14, but we still support older + * kernels where IFA_MAX is lower. */ +static const NLType rtnl_address_types[CONST_MAX(IFA_MAX, IFA_FLAGS) + 1] = { [IFA_ADDRESS] = { .type = NLA_IN_ADDR }, [IFA_LOCAL] = { .type = NLA_IN_ADDR }, [IFA_LABEL] = { .type = NLA_STRING, .size = IFNAMSIZ - 1 }, -- 2.30.2