[hackers] [st] Fix segmentation fault in strhandle() || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Mon, 27 Apr 2015 08:47:24 +0200 (CEST)

commit 0d7448dabc981716d277a5afac22fabc127bacca
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
Date: Thu Apr 23 17:55:41 2015 +0200

    Fix segmentation fault in strhandle()
    
    We cannot pass strescseq.args[0] to atoi when nargs is zero,
    because in this case it will be null.

diff --git a/st.c b/st.c
index 5e92db2..f9aba90 100644
--- a/st.c
+++ b/st.c
_AT_@ -2268,8 +2268,7 @@ strhandle(void) {
 
         term.esc &= ~(ESC_STR_END|ESC_STR);
         strparse();
- narg = strescseq.narg;
- par = atoi(strescseq.args[0]);
+ par = (narg = strescseq.narg) ? atoi(strescseq.args[0]) : 0;
 
         switch(strescseq.type) {
         case ']': /* OSC -- Operating System Command */
Received on Mon Apr 27 2015 - 08:47:24 CEST

This archive was generated by hypermail 2.3.0 : Mon Apr 27 2015 - 08:48:15 CEST