tr: fix "access past the end of a string" bug 4354
No binary (build failed)
—
(log yok)
| @@ -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 ']' */ | |