diff options
author | Jochen Sprickerhof <git@jochen.sprickerhof.de> | 2021-12-27 11:41:42 +0100 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2021-12-27 13:07:11 +0100 |
commit | a0467c802d4f86ed162486e3453dd61181423902 (patch) | |
tree | eb450474931db3dd6254c8cea090cfaf71a08048 | |
parent | 273db5ceaf392e68c2faf8f7dec14ea2e25e980d (diff) | |
download | st-patched-a0467c802d4f86ed162486e3453dd61181423902.tar.bz2 st-patched-a0467c802d4f86ed162486e3453dd61181423902.tar.xz st-patched-a0467c802d4f86ed162486e3453dd61181423902.zip |
Fix null pointer access in strhandle
According to the spec the argument is optional for 104, so p can be
NULL as can be tested with printf '\x1b]104\x07'. This is a regression
of 8e31030.
-rw-r--r-- | st.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1960,10 +1960,10 @@ strhandle(void) | |||
1960 | break; | 1960 | break; |
1961 | p = strescseq.args[2]; | 1961 | p = strescseq.args[2]; |
1962 | /* FALLTHROUGH */ | 1962 | /* FALLTHROUGH */ |
1963 | case 104: /* color reset, here p = NULL */ | 1963 | case 104: /* color reset */ |
1964 | j = (narg > 1) ? atoi(strescseq.args[1]) : -1; | 1964 | j = (narg > 1) ? atoi(strescseq.args[1]) : -1; |
1965 | 1965 | ||
1966 | if (!strcmp(p, "?")) | 1966 | if (p && !strcmp(p, "?")) |
1967 | osc4_color_response(j); | 1967 | osc4_color_response(j); |
1968 | else if (xsetcolorname(j, p)) { | 1968 | else if (xsetcolorname(j, p)) { |
1969 | if (par == 104 && narg <= 1) | 1969 | if (par == 104 && narg <= 1) |