From 67b5eeb93324f7484836be705698e72008498fe5 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko <vda.linux@googlemail.com> Date: Sun, 12 Apr 2009 13:54:13 +0000 Subject: awk: fix long field separators case. By Ian Wienand (ianw AT vmware.com) --- editors/awk.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'editors') diff --git a/editors/awk.c b/editors/awk.c index 9b15b3cd6..89ce2cfc8 100644 --- a/editors/awk.c +++ b/editors/awk.c @@ -1574,7 +1574,10 @@ static int awk_split(const char *s, node *spl, char **slist) if (s[l]) pmatch[0].rm_eo++; } memcpy(s1, s, l); - s1[l] = '\0'; + /* make sure we remove *all* of the separator chars */ + while (l < pmatch[0].rm_eo) { + s1[l++] = '\0'; + } nextword(&s1); s += pmatch[0].rm_eo; } while (*s); -- cgit v1.2.3-55-g6feb