Use strcpy where we control the buffer size - geomyidae - A small C-based gopherd. (gopher://bitreich.org/1/scm/geomyidae)
git clone git://r-36.net/geomyidae
Log
Files
Refs
README
LICENSE
---
commit e17f91b4d73eb422966cf614508e1074e364ef1e
parent 7ca184a99e81c3549a8a3d82ec7a201686cf3040
Author: Quentin Rameau 
Date:   Thu, 30 Aug 2018 21:15:58 +0200

Use strcpy where we control the buffer size

Signed-off-by: Christoph Lohmann <20h@r-36.net>

Diffstat:
  M ind.c                               |       4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/ind.c b/ind.c
@@ -296,8 +296,8 @@ addelem(Elems *e, char *s)
 
         e->num++;
         e->e = xrealloc(e->e, sizeof(char *) * e->num);
-        e->e[e->num - 1] = xcalloc(1, slen);
-        strncpy(e->e[e->num - 1], s, slen - 1);
+        e->e[e->num - 1] = xmalloc(slen);
+        strcpy(e->e[e->num - 1], s);
 
         return;
 }