aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-05-18 23:50:03 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-05-18 23:50:03 +0200
commite424423a7b164e0c343c180a944844fd27ccbe97 (patch)
treedd21ba522ce6ab967a5c598b02213fce01a3146d
parent167cd709df06fb0f7aa346a32133d54ed3ae6c48 (diff)
downloadbusybox-w32-e424423a7b164e0c343c180a944844fd27ccbe97.tar.gz
busybox-w32-e424423a7b164e0c343c180a944844fd27ccbe97.tar.bz2
busybox-w32-e424423a7b164e0c343c180a944844fd27ccbe97.zip
awk: put at least one NUL between $n. Hopefully closes 337.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--editors/awk.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/editors/awk.c b/editors/awk.c
index 924cfcfab..cef73342c 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -1571,13 +1571,14 @@ static int awk_split(const char *s, node *spl, char **slist)
1571 n++; /* we saw yet another delimiter */ 1571 n++; /* we saw yet another delimiter */
1572 } else { 1572 } else {
1573 pmatch[0].rm_eo = l; 1573 pmatch[0].rm_eo = l;
1574 if (s[l]) pmatch[0].rm_eo++; 1574 if (s[l])
1575 pmatch[0].rm_eo++;
1575 } 1576 }
1576 memcpy(s1, s, l); 1577 memcpy(s1, s, l);
1577 /* make sure we remove *all* of the separator chars */ 1578 /* make sure we remove *all* of the separator chars */
1578 while (l < pmatch[0].rm_eo) { 1579 do {
1579 s1[l++] = '\0'; 1580 s1[l] = '\0';
1580 } 1581 } while (++l < pmatch[0].rm_eo);
1581 nextword(&s1); 1582 nextword(&s1);
1582 s += pmatch[0].rm_eo; 1583 s += pmatch[0].rm_eo;
1583 } while (*s); 1584 } while (*s);