From: Phil Sutter Date: Wed, 19 Sep 2018 13:16:48 +0000 (+0200) Subject: libxt_LED: Avoid string overrun while parsing led-trigger-id X-Git-Tag: v1.8.1~34 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d0c1f1b4ad4e3b91220a03514031ee879db832d0;p=thirdparty%2Fiptables.git 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 --- 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)