aboutsummaryrefslogtreecommitdiff
path: root/coreutils/tr.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-07-26 19:34:00 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-07-26 19:34:00 +0000
commit5e40070d38cf02b96da72db5c6612e8971ef65f0 (patch)
tree6c5242140719a15c406e4d18888859e01986b3d0 /coreutils/tr.c
parentdf96df9c7c78d0f19c8d1ac1aa3d8d80abbe16bb (diff)
downloadbusybox-w32-5e40070d38cf02b96da72db5c6612e8971ef65f0.tar.gz
busybox-w32-5e40070d38cf02b96da72db5c6612e8971ef65f0.tar.bz2
busybox-w32-5e40070d38cf02b96da72db5c6612e8971ef65f0.zip
tr: fix "access past the end of a string" bug 4354
Diffstat (limited to 'coreutils/tr.c')
-rw-r--r--coreutils/tr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/coreutils/tr.c b/coreutils/tr.c
index e439fcb5b..28798fe4f 100644
--- a/coreutils/tr.c
+++ b/coreutils/tr.c
@@ -138,7 +138,7 @@ static unsigned int expand(const char *arg, char *buffer)
138 arg += 3; /* skip CHAR=] */ 138 arg += 3; /* skip CHAR=] */
139 continue; 139 continue;
140 } 140 }
141 if (*arg != '-') { /* not [x-...] - copy verbatim */ 141 if (i == '\0' || *arg != '-') { /* not [x-...] - copy verbatim */
142 *buffer++ = '['; 142 *buffer++ = '[';
143 arg--; /* points to x */ 143 arg--; /* points to x */
144 continue; /* copy all, including eventual ']' */ 144 continue; /* copy all, including eventual ']' */