diff options
author | Kevin McCarthy <kevin@8t8.us> | 2021-12-24 21:12:58 -0800 |
---|---|---|
committer | Kevin McCarthy <kevin@8t8.us> | 2021-12-25 13:42:01 -0800 |
commit | f58795c9ddf354eb7bb0412decb894fae3a19571 (patch) | |
tree | 2effcef5ab0521daa3a9ac4a48afbef5186d8856 | |
parent | c60ffa2740a6f82340c2dc56b8a2d80dfbfdb8f2 (diff) |
Fix mutt_ts_capability() fallback list loop.
The for loop termination check should be '*termp', not 'termp'. termp
starts as &known[0], so to check for the NULL terminator, we need to
look at *termp.
Since *termp is now checked in each loop, it no longer needs to be in
the if check inside the loop, so remove it there.
This hasn't been blowing up because the mutt_strncasecmp() check
inside the loop was also incorrect. It should be scanning for a
matching entry, but was looking for non-zero (nonmatching) retval.
Since term can't match both the first and second entries, it would
always return 1 and would never get to the loop NULL terminator.
-rw-r--r-- | curs_main.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/curs_main.c b/curs_main.c index edc3eac5..c0e150c7 100644 --- a/curs_main.c +++ b/curs_main.c @@ -179,9 +179,9 @@ short mutt_ts_capability(void) /* Check term types that are known to support the standard escape without * necessarily asserting it in terminfo. */ - for (termp = known; termp; termp++) + for (termp = known; *termp; termp++) { - if (term && *termp && mutt_strncasecmp (term, *termp, strlen(*termp))) + if (term && !mutt_strncasecmp (term, *termp, strlen(*termp))) return 1; } |