aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io/write.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgfortran/io/write.c')
-rw-r--r--libgfortran/io/write.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c
index 4ef3556..eacd1f7 100644
--- a/libgfortran/io/write.c
+++ b/libgfortran/io/write.c
@@ -1048,8 +1048,6 @@ btoa_big (const char *s, char *buffer, int len, GFC_UINTEGER_LARGEST *n)
}
}
- *q = '\0';
-
if (*n == 0)
return "0";
@@ -1207,6 +1205,9 @@ write_b (st_parameter_dt *dtp, const fnode *f, const char *source, int len)
char itoa_buf[GFC_BTOA_BUF_SIZE];
GFC_UINTEGER_LARGEST n = 0;
+ /* Ensure we end up with a null terminated string. */
+ memset(itoa_buf, '\0', GFC_BTOA_BUF_SIZE);
+
if (len > (int) sizeof (GFC_UINTEGER_LARGEST))
{
p = btoa_big (source, itoa_buf, len, &n);