tUse 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 a86a1cbb6590aed14e144d5abde60205654324d8
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:
  ind.c                               |       4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/ind.c b/ind.c
t@@ -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;
 }