projects
/
oweals
/
busybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
df96df9
)
tr: fix "access past the end of a string" bug 4354
author
Denis Vlasenko
<vda.linux@googlemail.com>
Sat, 26 Jul 2008 19:34:00 +0000
(19:34 -0000)
committer
Denis Vlasenko
<vda.linux@googlemail.com>
Sat, 26 Jul 2008 19:34:00 +0000
(19:34 -0000)
coreutils/tr.c
patch
|
blob
|
history
diff --git
a/coreutils/tr.c
b/coreutils/tr.c
index e439fcb5b03a792a7b1385298e2acb374f90df5a..28798fe4ff5d0c0ddbec58a2d3ffd3fc6b286d8f 100644
(file)
--- a/
coreutils/tr.c
+++ b/
coreutils/tr.c
@@
-138,7
+138,7
@@
static unsigned int expand(const char *arg, char *buffer)
arg += 3; /* skip CHAR=] */
continue;
}
- if (*arg != '-') { /* not [x-...] - copy verbatim */
+ if (
i == '\0' ||
*arg != '-') { /* not [x-...] - copy verbatim */
*buffer++ = '[';
arg--; /* points to x */
continue; /* copy all, including eventual ']' */