summaryrefslogtreecommitdiffstats
path: root/contrib/one-true-awk/lib.c
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2011-05-03 11:47:19 +0000
committerru <ru@FreeBSD.org>2011-05-03 11:47:19 +0000
commit169254209b0bd6089f3bef289d398b21882bac83 (patch)
treeeb10e239bd7475967e0d02980aa01bd433651c71 /contrib/one-true-awk/lib.c
parent582de70a4368320790784013e7b8897b0ae17b41 (diff)
downloadFreeBSD-src-169254209b0bd6089f3bef289d398b21882bac83.zip
FreeBSD-src-169254209b0bd6089f3bef289d398b21882bac83.tar.gz
Update to a 1-May-2011 release (except for the isblank change).
Diffstat (limited to 'contrib/one-true-awk/lib.c')
-rw-r--r--contrib/one-true-awk/lib.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/contrib/one-true-awk/lib.c b/contrib/one-true-awk/lib.c
index 017b376..d7eee31 100644
--- a/contrib/one-true-awk/lib.c
+++ b/contrib/one-true-awk/lib.c
@@ -256,6 +256,7 @@ void fldbld(void) /* create fields from current record */
{
/* this relies on having fields[] the same length as $0 */
/* the fields are all stored in this one array with \0's */
+ /* possibly with a final trailing \0 not associated with any field */
char *r, *fr, sep;
Cell *p;
int i, j, n;
@@ -268,7 +269,7 @@ void fldbld(void) /* create fields from current record */
n = strlen(r);
if (n > fieldssize) {
xfree(fields);
- if ((fields = (char *) malloc(n+1)) == NULL)
+ if ((fields = (char *) malloc(n+2)) == NULL) /* possibly 2 final \0s */
FATAL("out of space for fields in fldbld %d", n);
fieldssize = n;
}
OpenPOWER on IntegriCloud