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 <p...@nwl.cc>
---
 extensions/libxt_LED.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/extensions/libxt_LED.c b/extensions/libxt_LED.c
index 8622c379e68bc..6ada795056431 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)
-- 
2.18.0

Reply via email to