[hackers] [st] Fix core in multi-line selection on OpenBSD || Maurice Quennet

From: <git_AT_suckless.org>
Date: Mon, 23 Sep 2013 19:29:29 +0200

commit eeae9b0ceef9e2fec4cb4f1132748c302e5ac702
Author: Maurice Quennet <mjq_AT_gmx.net>
Date: Sat Sep 21 23:33:56 2013 +0200

    Fix core in multi-line selection on OpenBSD
    
    OpenBSD 5.3 amd64 release version with the most current st
    version from git, crash and dump core when selecting multiple
    lines whith the cursor. This happens, because on line 964
    of st.c (gp-1)->mode is accessed, although gp is still
    pointing at the beginning of the array term.line[y] (see
    line 939 for initialization of gp).

diff --git a/st.c b/st.c
index df58e9e..c3a04c5 100644
--- a/st.c
+++ b/st.c
_AT_@ -962,7 +962,7 @@ selcopy(void) {
                          * st.
                          * FIXME: Fix the computer world.
                          */
- if(y < sel.ne.y && !((gp-1)->mode & ATTR_WRAP))
+ if(y < sel.ne.y && x > 0 && !((gp-1)->mode & ATTR_WRAP))
                                 *ptr++ = '
';
 
                         /*
Received on Mon Sep 23 2013 - 19:29:29 CEST

This archive was generated by hypermail 2.3.0 : Mon Sep 23 2013 - 19:36:18 CEST