Xinqi Bao's Git
projects
/
st.git
/ diff
summary
|
log
|
commit
|
diff
|
tree
raw
|
patch
|
inline
| side by side (parent:
b17aa18
)
Fix segmentation fault in strhandle()
author
Roberto E. Vargas Caballero <
[email protected]
>
Thu, 23 Apr 2015 15:55:41 +0000
(17:55 +0200)
committer
Roberto E. Vargas Caballero <
[email protected]
>
Thu, 23 Apr 2015 15:59:10 +0000
(17:59 +0200)
We cannot pass strescseq.args[0] to atoi when nargs is zero,
because in this case it will be null.
st.c
diff
|
blob
|
history
diff --git
a/st.c
b/st.c
index
5e92db2
..
f9aba90
100644
(file)
--- a/
st.c
+++ b/
st.c
@@
-2268,8
+2268,7
@@
strhandle(void) {
term.esc &= ~(ESC_STR_END|ESC_STR);
strparse();
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 */
switch(strescseq.type) {
case ']': /* OSC -- Operating System Command */