aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/tr.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/coreutils/tr.c b/coreutils/tr.c
index 860b8122b..c736c716b 100644
--- a/coreutils/tr.c
+++ b/coreutils/tr.c
@@ -145,12 +145,14 @@ static unsigned int expand(const char *arg, char *buffer)
arg--; /* points to x */
continue; /* copy all, including eventual ']' */
}
- /* [x-y...] */
- arg++;
+ /* [x-z] */
+ arg++; /* skip - */
+ if (arg[0] == '\0' || arg[1] != ']')
+ bb_show_usage();
ac = *arg++;
while (i <= ac)
*buffer++ = i++;
- arg++; /* skip the assumed ']' */
+ arg++; /* skip ] */
continue;
}
*buffer++ = *arg++;