aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJochen Sprickerhof <git@jochen.sprickerhof.de>2021-12-27 11:41:42 +0100
committerHiltjo Posthuma <hiltjo@codemadness.org>2021-12-27 13:07:11 +0100
commita0467c802d4f86ed162486e3453dd61181423902 (patch)
treeeb450474931db3dd6254c8cea090cfaf71a08048
parent273db5ceaf392e68c2faf8f7dec14ea2e25e980d (diff)
downloadst-a0467c802d4f86ed162486e3453dd61181423902.tar.zst
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.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/st.c b/st.c
index 6783c2b..de2dd0e 100644
--- a/st.c
+++ b/st.c
@@ -1960,10 +1960,10 @@ strhandle(void)
break;
p = strescseq.args[2];
/* FALLTHROUGH */
- case 104: /* color reset, here p = NULL */
+ case 104: /* color reset */
j = (narg > 1) ? atoi(strescseq.args[1]) : -1;
- if (!strcmp(p, "?"))
+ if (p && !strcmp(p, "?"))
osc4_color_response(j);
else if (xsetcolorname(j, p)) {
if (par == 104 && narg <= 1)