• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From 800bed28b2b7bbd931166c7426640ae619f03342 Mon Sep 17 00:00:00 2001
2From: Phil Sutter <phil@nwl.cc>
3Date: Wed, 16 Nov 2022 13:09:16 +0100
4Subject: [PATCH] extensions: libipt_ttl: Sanitize xlate callback
5
6Catch unexpected values in info->mode, also fix indenting.
7
8Conflict: NA
9Reference: https://git.netfilter.org/iptables/commit?id=800bed28b2b7bbd931166c7426640ae619f03342
10
11Fixes: 1b320a1a1dc1f ("extensions: libipt_ttl: Add translation to nft")
12Signed-off-by: Phil Sutter <phil@nwl.cc>
13---
14 extensions/libipt_ttl.c | 4 ++--
15 1 file changed, 2 insertions(+), 2 deletions(-)
16
17diff --git a/extensions/libipt_ttl.c b/extensions/libipt_ttl.c
18index 6bdd2196..86ba554e 100644
19--- a/extensions/libipt_ttl.c
20+++ b/extensions/libipt_ttl.c
21@@ -106,7 +106,7 @@ static int ttl_xlate(struct xt_xlate *xl,
22 	const struct ipt_ttl_info *info =
23 		(struct ipt_ttl_info *) params->match->data;
24
25-		switch (info->mode) {
26+	switch (info->mode) {
27 		case IPT_TTL_EQ:
28 			xt_xlate_add(xl, "ip ttl");
29 			break;
30@@ -121,7 +121,7 @@ static int ttl_xlate(struct xt_xlate *xl,
31 			break;
32 		default:
33 			/* Should not happen. */
34-			break;
35+			return 0;
36 	}
37
38 	xt_xlate_add(xl, " %u", info->ttl);
39--
402.23.0
41