use calloc in get_line() when allocating line to ensure it is fully initialized,
 fixes a later uninitialized value in copy_param() (FreeBSD #193499).

PR: 193499
Submitted by: Thomas E. Dickey  <tom@invisible-island.net>
This commit is contained in:
Craig Rodrigues 2014-10-06 14:43:02 +00:00
parent bbd5a84297
commit ab7bf3d49d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=272649
3 changed files with 8 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2014-10-02 Thomas E. Dickey <tom@invisible-island.net>
* reader.c, defs.h:
use calloc in get_line() when allocating line to ensure it is fully initialized,
fixes a later uninitialized value in copy_param() (FreeBSD #193499).
2014-07-15 Thomas E. Dickey <tom@invisible-island.net>
* aclocal.m4: resync with my-autoconf (no change to configure script)

View File

@ -157,6 +157,7 @@
#define CALLOC(k,n) (calloc((size_t)(k),(size_t)(n)))
#define FREE(x) (free((char*)(x)))
#define MALLOC(n) (malloc((size_t)(n)))
#define TCMALLOC(t,n) ((t*) calloc((size_t)(n), sizeof(t)))
#define TMALLOC(t,n) ((t*) malloc((size_t)(n) * sizeof(t)))
#define NEW(t) ((t*)allocate(sizeof(t)))
#define NEW2(n,t) ((t*)allocate(((size_t)(n)*sizeof(t))))

View File

@ -125,7 +125,7 @@ get_line(void)
if (line)
FREE(line);
linesize = LINESIZE + 1;
line = TMALLOC(char, linesize);
line = TCMALLOC(char, linesize);
NO_SPACE(line);
}