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