Fix segmentation fault in tr(1) with -dc and one set

This commit is contained in:
FRIGN 2015-02-02 17:57:46 +01:00
parent fdcfbba96c
commit f9d9672326
1 changed files with 11 additions and 4 deletions

15
tr.c
View File

@ -208,8 +208,12 @@ read:
off1 = off2 = 0;
for (i = 0; i < set1ranges; i++) {
if (set1[i].start <= r && r <= set1[i].end) {
if (dflag && !cflag)
goto read;
if (dflag) {
if (cflag)
goto write;
else
goto read;
}
if (sflag) {
if (r == lastrune)
goto read;
@ -237,8 +241,11 @@ read:
}
}
if (set1check && set1check((wint_t)r)) {
if (dflag && !cflag)
goto read;
if (dflag)
if (cflag)
goto write;
else
goto read;
if (sflag) {
if (r == lastrune)
goto read;