Fix segmentation fault in tr(1) with -dc and one set
This commit is contained in:
parent
fdcfbba96c
commit
f9d9672326
15
tr.c
15
tr.c
@ -208,8 +208,12 @@ read:
|
|||||||
off1 = off2 = 0;
|
off1 = off2 = 0;
|
||||||
for (i = 0; i < set1ranges; i++) {
|
for (i = 0; i < set1ranges; i++) {
|
||||||
if (set1[i].start <= r && r <= set1[i].end) {
|
if (set1[i].start <= r && r <= set1[i].end) {
|
||||||
if (dflag && !cflag)
|
if (dflag) {
|
||||||
goto read;
|
if (cflag)
|
||||||
|
goto write;
|
||||||
|
else
|
||||||
|
goto read;
|
||||||
|
}
|
||||||
if (sflag) {
|
if (sflag) {
|
||||||
if (r == lastrune)
|
if (r == lastrune)
|
||||||
goto read;
|
goto read;
|
||||||
@ -237,8 +241,11 @@ read:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (set1check && set1check((wint_t)r)) {
|
if (set1check && set1check((wint_t)r)) {
|
||||||
if (dflag && !cflag)
|
if (dflag)
|
||||||
goto read;
|
if (cflag)
|
||||||
|
goto write;
|
||||||
|
else
|
||||||
|
goto read;
|
||||||
if (sflag) {
|
if (sflag) {
|
||||||
if (r == lastrune)
|
if (r == lastrune)
|
||||||
goto read;
|
goto read;
|
||||||
|
Loading…
Reference in New Issue
Block a user