diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 3e8173913a0..986b2b0a31e 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,10 @@ +2017-12-03 Jerry DeLisle + + Backport from trunk + PR libgfortran/83168 + * io/write.c (select_string): Bump size by one to avoid + overrun. + 2017-12-03 Jerry DeLisle Dominique d'Humieres diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c index f80a7c36265..d483de125f7 100644 --- a/libgfortran/io/write.c +++ b/libgfortran/io/write.c @@ -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