From 55516f2d1bfeb26538c6339338f5d2cefa6c9b37 Mon Sep 17 00:00:00 2001 From: Pierre Date: Thu, 26 Jul 2018 11:37:43 +0200 Subject: [PATCH] secure strncat --- src/faust_tilde_ui.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/faust_tilde_ui.c b/src/faust_tilde_ui.c index 3cbefb4..ef75d7a 100644 --- a/src/faust_tilde_ui.c +++ b/src/faust_tilde_ui.c @@ -110,10 +110,10 @@ static t_symbol* faust_ui_manager_get_long_name(t_faust_ui_manager *x, const cha memset(name, 0, MAXFAUSTSTRING); for(i = 0; i < x->f_nnames; ++i) { - strncat(name, x->f_names[i]->s_name, MAXFAUSTSTRING); - strncat(name, "/", 1); + strncat(name, x->f_names[i]->s_name, MAXFAUSTSTRING - strnlen(name, MAXFAUSTSTRING) - 1); + strncat(name, "/", MAXFAUSTSTRING - strnlen(name, MAXFAUSTSTRING) - 1); } - strncat(name, label, MAXFAUSTSTRING); + strncat(name, label, MAXFAUSTSTRING - strnlen(name, MAXFAUSTSTRING) - 1); return gensym(name); }