Blame SOURCES/libxt_LED-Avoid-string-overrun-while-parsing-led-tri.patch

9a3fa7
From a7bb46f478443597a7e97e81adb13d9619f4b1a7 Mon Sep 17 00:00:00 2001
9a3fa7
From: Phil Sutter <psutter@redhat.com>
9a3fa7
Date: Fri, 15 Mar 2019 17:51:28 +0100
9a3fa7
Subject: [PATCH] libxt_LED: Avoid string overrun while parsing led-trigger-id
9a3fa7
9a3fa7
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1525980
9a3fa7
Upstream Status: iptables commit d0c1f1b4ad4e3
9a3fa7
9a3fa7
commit d0c1f1b4ad4e3b91220a03514031ee879db832d0
9a3fa7
Author: Phil Sutter <phil@nwl.cc>
9a3fa7
Date:   Wed Sep 19 15:16:48 2018 +0200
9a3fa7
9a3fa7
    libxt_LED: Avoid string overrun while parsing led-trigger-id
9a3fa7
9a3fa7
    Instead of using strcat() and assuming the name will fit, print into the
9a3fa7
    buffer using snprintf() which truncates the string as needed.
9a3fa7
9a3fa7
    Signed-off-by: Phil Sutter <phil@nwl.cc>
9a3fa7
    Signed-off-by: Florian Westphal <fw@strlen.de>
9a3fa7
9a3fa7
Signed-off-by: Phil Sutter <psutter@redhat.com>
9a3fa7
---
9a3fa7
 extensions/libxt_LED.c | 3 +--
9a3fa7
 1 file changed, 1 insertion(+), 2 deletions(-)
9a3fa7
9a3fa7
diff --git a/extensions/libxt_LED.c b/extensions/libxt_LED.c
9a3fa7
index 8622c379e68bc..6ada795056431 100644
9a3fa7
--- a/extensions/libxt_LED.c
9a3fa7
+++ b/extensions/libxt_LED.c
9a3fa7
@@ -53,8 +53,7 @@ static void LED_parse(struct xt_option_call *cb)
9a3fa7
 	xtables_option_parse(cb);
9a3fa7
 	switch (cb->entry->id) {
9a3fa7
 	case O_LED_TRIGGER_ID:
9a3fa7
-		strcpy(led->id, "netfilter-");
9a3fa7
-		strcat(led->id, cb->arg);
9a3fa7
+		snprintf(led->id, sizeof(led->id), "netfilter-%s", cb->arg);
9a3fa7
 		break;
9a3fa7
 	case O_LED_DELAY:
9a3fa7
 		if (strncasecmp(cb->arg, "inf", 3) == 0)
9a3fa7
-- 
9a3fa7
2.21.0
9a3fa7