From d0c1f1b4ad4e3b91220a03514031ee879db832d0 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Wed, 19 Sep 2018 15:16:48 +0200 Subject: libxt_LED: Avoid string overrun while parsing led-trigger-id Instead of using strcat() and assuming the name will fit, print into the buffer using snprintf() which truncates the string as needed. Signed-off-by: Phil Sutter Signed-off-by: Florian Westphal --- extensions/libxt_LED.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'extensions') diff --git a/extensions/libxt_LED.c b/extensions/libxt_LED.c index 8622c379..6ada7950 100644 --- a/extensions/libxt_LED.c +++ b/extensions/libxt_LED.c @@ -53,8 +53,7 @@ static void LED_parse(struct xt_option_call *cb) xtables_option_parse(cb); switch (cb->entry->id) { case O_LED_TRIGGER_ID: - strcpy(led->id, "netfilter-"); - strcat(led->id, cb->arg); + snprintf(led->id, sizeof(led->id), "netfilter-%s", cb->arg); break; case O_LED_DELAY: if (strncasecmp(cb->arg, "inf", 3) == 0) -- cgit v1.2.3