Blame SOURCES/libxtables-Check-extension-real_name-length.patch

43df5c
From e4dd398938aed75397463aed36fc03f9d754bf29 Mon Sep 17 00:00:00 2001
43df5c
From: Phil Sutter <psutter@redhat.com>
43df5c
Date: Fri, 15 Mar 2019 17:51:28 +0100
43df5c
Subject: [PATCH] libxtables: Check extension real_name length
43df5c
43df5c
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1525980
43df5c
Upstream Status: iptables commit a3716cc1a501e
43df5c
43df5c
commit a3716cc1a501e40e26a96d78b2e1285bb081f366
43df5c
Author: Phil Sutter <phil@nwl.cc>
43df5c
Date:   Mon Sep 24 19:25:21 2018 +0200
43df5c
43df5c
    libxtables: Check extension real_name length
43df5c
43df5c
    Just like with 'name', if given check 'real_name' to not exceed max length.
43df5c
43df5c
    Signed-off-by: Phil Sutter <phil@nwl.cc>
43df5c
    Signed-off-by: Florian Westphal <fw@strlen.de>
43df5c
43df5c
Signed-off-by: Phil Sutter <psutter@redhat.com>
43df5c
---
43df5c
 libxtables/xtables.c | 12 ++++++++++++
43df5c
 1 file changed, 12 insertions(+)
43df5c
43df5c
diff --git a/libxtables/xtables.c b/libxtables/xtables.c
43df5c
index 575f7ee0a0d78..4a014e48a9f45 100644
43df5c
--- a/libxtables/xtables.c
43df5c
+++ b/libxtables/xtables.c
43df5c
@@ -839,6 +839,12 @@ void xtables_register_match(struct xtables_match *me)
43df5c
 		exit(1);
43df5c
 	}
43df5c
 
43df5c
+	if (me->real_name && strlen(me->real_name) >= XT_EXTENSION_MAXNAMELEN) {
43df5c
+		fprintf(stderr, "%s: match `%s' has invalid real name\n",
43df5c
+			xt_params->program_name, me->real_name);
43df5c
+		exit(1);
43df5c
+	}
43df5c
+
43df5c
 	if (me->family >= NPROTO) {
43df5c
 		fprintf(stderr,
43df5c
 			"%s: BUG: match %s has invalid protocol family\n",
43df5c
@@ -997,6 +1003,12 @@ void xtables_register_target(struct xtables_target *me)
43df5c
 		exit(1);
43df5c
 	}
43df5c
 
43df5c
+	if (me->real_name && strlen(me->real_name) >= XT_EXTENSION_MAXNAMELEN) {
43df5c
+		fprintf(stderr, "%s: target `%s' has invalid real name\n",
43df5c
+			xt_params->program_name, me->real_name);
43df5c
+		exit(1);
43df5c
+	}
43df5c
+
43df5c
 	if (me->family >= NPROTO) {
43df5c
 		fprintf(stderr,
43df5c
 			"%s: BUG: target %s has invalid protocol family\n",
43df5c
-- 
43df5c
2.21.0
43df5c