Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Oct 2014 14:43:02 +0000 (UTC)
From:      Craig Rodrigues <rodrigc@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r272649 - head/contrib/byacc
Message-ID:  <201410061443.s96Eh2Jn022718@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rodrigc
Date: Mon Oct  6 14:43:02 2014
New Revision: 272649
URL: https://svnweb.freebsd.org/changeset/base/272649

Log:
  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>

Modified:
  head/contrib/byacc/CHANGES
  head/contrib/byacc/defs.h
  head/contrib/byacc/reader.c

Modified: head/contrib/byacc/CHANGES
==============================================================================
--- head/contrib/byacc/CHANGES	Mon Oct  6 14:39:45 2014	(r272648)
+++ head/contrib/byacc/CHANGES	Mon Oct  6 14:43:02 2014	(r272649)
@@ -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)

Modified: head/contrib/byacc/defs.h
==============================================================================
--- head/contrib/byacc/defs.h	Mon Oct  6 14:39:45 2014	(r272648)
+++ head/contrib/byacc/defs.h	Mon Oct  6 14:43:02 2014	(r272649)
@@ -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))))

Modified: head/contrib/byacc/reader.c
==============================================================================
--- head/contrib/byacc/reader.c	Mon Oct  6 14:39:45 2014	(r272648)
+++ head/contrib/byacc/reader.c	Mon Oct  6 14:43:02 2014	(r272649)
@@ -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);
     }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410061443.s96Eh2Jn022718>