tr: fix yet another access past the end of a string (bug 4374)
This commit is contained in:
parent
b357149867
commit
20be63fe71
@ -145,12 +145,14 @@ static unsigned int expand(const char *arg, char *buffer)
|
|||||||
arg--; /* points to x */
|
arg--; /* points to x */
|
||||||
continue; /* copy all, including eventual ']' */
|
continue; /* copy all, including eventual ']' */
|
||||||
}
|
}
|
||||||
/* [x-y...] */
|
/* [x-z] */
|
||||||
arg++;
|
arg++; /* skip - */
|
||||||
|
if (arg[0] == '\0' || arg[1] != ']')
|
||||||
|
bb_show_usage();
|
||||||
ac = *arg++;
|
ac = *arg++;
|
||||||
while (i <= ac)
|
while (i <= ac)
|
||||||
*buffer++ = i++;
|
*buffer++ = i++;
|
||||||
arg++; /* skip the assumed ']' */
|
arg++; /* skip ] */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
*buffer++ = *arg++;
|
*buffer++ = *arg++;
|
||||||
|
Loading…
Reference in New Issue
Block a user