| Use strcpy where we control the buffer size - geomyidae - A small C-based gophe… | |
| git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfri… | |
| Log | |
| Files | |
| Refs | |
| Tags | |
| README | |
| LICENSE | |
| --- | |
| commit e17f91b4d73eb422966cf614508e1074e364ef1e | |
| parent 7ca184a99e81c3549a8a3d82ec7a201686cf3040 | |
| Author: Quentin Rameau <[email protected]> | |
| Date: Thu, 30 Aug 2018 21:15:58 +0200 | |
| Use strcpy where we control the buffer size | |
| Signed-off-by: Christoph Lohmann <[email protected]> | |
| 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; | |
| } |