diff options
author | rodrigc <rodrigc@FreeBSD.org> | 2014-10-06 14:43:02 +0000 |
---|---|---|
committer | rodrigc <rodrigc@FreeBSD.org> | 2014-10-06 14:43:02 +0000 |
commit | 5061170980eb8679d5bbc506c153b9bfeff941f6 (patch) | |
tree | 843431d6fb738cd96b6bae6ae5db4659fe025bb8 /contrib/byacc | |
parent | c5e00288f365a2ac04c0da4345c1988a52174195 (diff) | |
download | FreeBSD-src-5061170980eb8679d5bbc506c153b9bfeff941f6.zip FreeBSD-src-5061170980eb8679d5bbc506c153b9bfeff941f6.tar.gz |
MFV:
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>
Diffstat (limited to 'contrib/byacc')
-rw-r--r-- | contrib/byacc/CHANGES | 6 | ||||
-rw-r--r-- | contrib/byacc/defs.h | 1 | ||||
-rw-r--r-- | contrib/byacc/reader.c | 2 |
3 files changed, 8 insertions, 1 deletions
diff --git a/contrib/byacc/CHANGES b/contrib/byacc/CHANGES index c9d73ce..7d05c381 100644 --- a/contrib/byacc/CHANGES +++ b/contrib/byacc/CHANGES @@ -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) diff --git a/contrib/byacc/defs.h b/contrib/byacc/defs.h index 58ebc8d..300b209 100644 --- a/contrib/byacc/defs.h +++ b/contrib/byacc/defs.h @@ -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)))) diff --git a/contrib/byacc/reader.c b/contrib/byacc/reader.c index 8312a69..dfd3620 100644 --- a/contrib/byacc/reader.c +++ b/contrib/byacc/reader.c @@ -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); } |