← Commit list

5e40070d3

Denis Vlasenko
Denis Vlasenko
2008-07-26
FAILED Duration: 21s

Subject

tr: fix "access past the end of a string" bug 4354

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

coreutils/tr.c+1 -1
@@ -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 ']' */