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  <t...@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  <t...@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  <t...@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);
     }
 
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to