From 939948df90dcd536c7c087fce2161ca409d84bd5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Albert=20Gr=C3=A4f?= <aggraef@gmail.com>
Date: Sun, 30 Aug 2020 19:24:09 +0200
Subject: [PATCH] Bugfix (import_output, fix potentially unterminated strncpy).

---
 pd/src/import.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pd/src/import.c b/pd/src/import.c
index 72df5e2fb..c12fc1c01 100644
--- a/pd/src/import.c
+++ b/pd/src/import.c
@@ -105,7 +105,8 @@ static void import_output(t_import* x)
  * namespace, [import] will output the new element on the next bang. */
     if(x->x_current)
     {
-        strncpy(buffer, x->x_current->nl_string, MAXPDSTRING);
+        strncpy(buffer, x->x_current->nl_string, MAXPDSTRING-1);
+        buffer[MAXPDSTRING-1] = 0;
         outlet_symbol( x->x_data_outlet, gensym(buffer));
         x->x_current = x->x_current->nl_next;
     }
-- 
GitLab