summaryrefslogtreecommitdiff
path: root/usr.bin/awk/run.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2020-07-01 13:32:28 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2020-07-01 13:32:28 +0000
commitef48d747bcccd98eff063e80e6341971edb03aed (patch)
tree3e752b9aaba50cf6856e171b9f1be4ba503e86d6 /usr.bin/awk/run.c
parent6bbb100b9c00f063e424174411bb6491d11c3ccb (diff)
Fix regression with changed SUBSEP in subscript in version 20191024.
The length of SUBSEP needs to be rechecked after calling execute(), in case SUBSEP itself has been changed. From tim@
Diffstat (limited to 'usr.bin/awk/run.c')
-rw-r--r--usr.bin/awk/run.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/awk/run.c b/usr.bin/awk/run.c
index fcfe239726e..001c8476833 100644
--- a/usr.bin/awk/run.c
+++ b/usr.bin/awk/run.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: run.c,v 1.61 2020/07/01 13:26:54 millert Exp $ */
+/* $OpenBSD: run.c,v 1.62 2020/07/01 13:32:27 millert Exp $ */
/****************************************************************
Copyright (C) Lucent Technologies 1997
All Rights Reserved
@@ -472,7 +472,7 @@ makearraystring(Node *p, const char *func)
{
char *buf;
int bufsz = recsize;
- size_t blen, seplen;
+ size_t blen;
if ((buf = malloc(bufsz)) == NULL) {
FATAL("%s: out of memory", func);
@@ -480,11 +480,11 @@ makearraystring(Node *p, const char *func)
blen = 0;
buf[blen] = '\0';
- seplen = strlen(getsval(subseploc));
for (; p; p = p->nnext) {
Cell *x = execute(p); /* expr */
char *s = getsval(x);
+ size_t seplen = strlen(getsval(subseploc));
size_t nsub = p->nnext ? seplen : 0;
size_t slen = strlen(s);
size_t tlen = blen + slen + nsub;