summaryrefslogtreecommitdiff
path: root/field.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2014-11-11 23:12:01 +0200
committerArnold D. Robbins <arnold@skeeve.com>2014-11-11 23:12:01 +0200
commitb4cf3cc470eb1200ec90fcc7ad5b2d069059cf7e (patch)
tree018a69e2dfd74b91f01bf452d4708f10ce2f3c52 /field.c
parent350265fafb2a0153d4207c67d626f135b308ad34 (diff)
downloadgawk-b4cf3cc470eb1200ec90fcc7ad5b2d069059cf7e.tar.gz
Fix memory growth problem.
Diffstat (limited to 'field.c')
-rw-r--r--field.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/field.c b/field.c
index 4819ea94..7b4f2190 100644
--- a/field.c
+++ b/field.c
@@ -277,6 +277,12 @@ set_record(const char *buf, int cnt)
/* copy the data */
memcpy(databuf, buf, cnt);
+ /*
+ * Add terminating '\0' so that C library routines
+ * will know when to stop.
+ */
+ databuf[cnt] = '\0';
+
/* manage field 0: */
unref(fields_arr[0]);
getnode(n);