aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)
145 arg--; /* points to x */ 145 arg--; /* points to x */
146 continue; /* copy all, including eventual ']' */ 146 continue; /* copy all, including eventual ']' */
147 } 147 }
148 /* [x-y...] */ 148 /* [x-z] */
149 arg++; 149 arg++; /* skip - */
150 if (arg[0] == '\0' || arg[1] != ']')
151 bb_show_usage();
150 ac = *arg++; 152 ac = *arg++;
151 while (i <= ac) 153 while (i <= ac)
152 *buffer++ = i++; 154 *buffer++ = i++;
153 arg++; /* skip the assumed ']' */ 155 arg++; /* skip ] */
154 continue; 156 continue;
155 } 157 }
156 *buffer++ = *arg++; 158 *buffer++ = *arg++;