sbase

suckless unix tools
git clone git://git.2f30.org/sbase.git
Log | Files | Refs | README | LICENSE

commit f9d9672326d2b754833151c624b90fde9b06c817
parent fdcfbba96c19a7f63cbf6f9630ff67f85e333816
Author: FRIGN <dev@frign.de>
Date:   Mon Feb  2 17:57:46 +0100

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

Diffstat:
tr.c | 15+++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/tr.c b/tr.c @@ -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;