From 367cbfaae87c1f539c729b0653d920701beac3be Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Sun, 20 Jul 2014 14:09:34 +0200 Subject: src: stricter netlink attribute length validation If the kernel sends us different data length for a given attribute, stop further processing and indicate that an ABI breakage has ocurred. This is an example of the (hypothetical) message that is shown in that case: nf_tables kernel ABI is broken, contact your vendor. table.c:214 reason: Numerical result out of range Signed-off-by: Pablo Neira Ayuso --- src/utils.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/utils.c') diff --git a/src/utils.c b/src/utils.c index 20a2fa3..1878390 100644 --- a/src/utils.c +++ b/src/utils.c @@ -225,3 +225,10 @@ void __nft_assert_fail(uint16_t attr, const char *filename, int line) attr, filename, line); exit(EXIT_FAILURE); } + +void __noreturn __abi_breakage(const char *file, int line, const char *reason) +{ + fprintf(stderr, "nf_tables kernel ABI is broken, contact your vendor.\n" + "%s:%d reason: %s\n", file, line, reason); + exit(EXIT_FAILURE); +} -- cgit v1.2.3