aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-07-28 23:49:42 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-07-28 23:49:42 +0000
commit043d15da31200d35c24bc1939ae6b561f5016c84 (patch)
treef407b8eced3c7ff7ff8176e7ddb5fa87f8760bad
parent918a34b9e04cbf368dd7a1116d7467e6e7f8ccc9 (diff)
downloadbusybox-043d15da31200d35c24bc1939ae6b561f5016c84.tar.gz
tr: fix "tr [=" case. Closes bug 4374.
function old new delta expand 1701 1738 +37 tr_main 472 474 +2
-rw-r--r--coreutils/tr.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/coreutils/tr.c b/coreutils/tr.c
index 28798fe4f..860b8122b 100644
--- a/coreutils/tr.c
+++ b/coreutils/tr.c
@@ -135,6 +135,8 @@ static unsigned int expand(const char *arg, char *buffer)
/* "[xyz...", i=x, arg points to y */
if (ENABLE_FEATURE_TR_EQUIV && i == '=') { /* [=CHAR=] */
*buffer++ = *arg; /* copy CHAR */
+ if (!*arg || arg[1] != '=' || arg[2] != ']')
+ bb_show_usage();
arg += 3; /* skip CHAR=] */
continue;
}