Commit 0d7448d

Roberto E. Vargas Caballero <k0ga@shike2.com>
2015-04-23 11:55:41
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.
1 parent b17aa18
Changed files (1)
st.c
@@ -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 */