re PR libfortran/83168 (FAIL: gfortran.dg/fmt_f0_2.f90 with a sanitized libgfortran)
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Wed, 29 Nov 2017 03:07:43 +0000 (03:07 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Wed, 29 Nov 2017 03:07:43 +0000 (03:07 +0000)
2017-11-28  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

PR libgfortran/83168
* io/write.c (select_string): Bump size by one to avoid
overrun.

From-SVN: r255225

libgfortran/ChangeLog
libgfortran/io/write.c

index 6940f790b5c932870e71c708117c7df444317015..251e6b4c462c345f7283ce62357153b26867e7e2 100644 (file)
@@ -1,3 +1,9 @@
+2017-11-28  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR libgfortran/83168
+       * io/write.c (select_string): Bump size by one to avoid 
+       overrun.
+
 2017-11-24  Janne Blomqvist  <jb@gcc.gnu.org>
 
        PR fortran/36313
index f4172029c0ed7dfb49a072b2968437dbe3172d81..582d196c4e30a40771ffc4569d5f1e579735c5ec 100644 (file)
@@ -1552,7 +1552,7 @@ select_string (st_parameter_dt *dtp, const fnode *f, char *buf, size_t *size,
               int kind)
 {
   char *result;
-  *size = size_from_kind (dtp, f, kind) + f->u.real.d;
+  *size = size_from_kind (dtp, f, kind) + f->u.real.d + 1;
   if (*size > BUF_STACK_SZ)
      result = xmalloc (*size);
   else