Use strcpy where we control the buffer size - geomyidae - A small C-based gopherd.
(HTM) git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/geomyidae/
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) README
(DIR) LICENSE
---
(DIR) commit a86a1cbb6590aed14e144d5abde60205654324d8
(DIR) parent 7ca184a99e81c3549a8a3d82ec7a201686cf3040
(HTM) Author: Quentin Rameau <quinq@fifth.space>
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(-)
---
(DIR) 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;
}