[hackers] [sbase] Fix segmentation fault in tr(1) with -dc and one set || FRIGN

From: <git_AT_suckless.org>
Date: Mon, 2 Feb 2015 18:12:52 +0100 (CET)

commit d5d8d3a70c94b9e61c2722b20aaf411334680f2a
Author: FRIGN <dev_AT_frign.de>
Date: Mon Feb 2 17:57:46 2015 +0100

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

diff --git a/tr.c b/tr.c
index 2ac5bd1..352a862 100644
--- a/tr.c
+++ b/tr.c
_AT_@ -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;
_AT_@ -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;
Received on Mon Feb 02 2015 - 18:12:52 CET

This archive was generated by hypermail 2.3.0 : Mon Feb 02 2015 - 18:24:09 CET