summaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
authorJochen Sprickerhof <git@jochen.sprickerhof.de>2021-12-27 11:41:42 +0100
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2023-05-08 00:34:39 +0200
commit6de651ba67439cfb18904d92a49351118a850e0e (patch)
tree1d981fa1eef932867e09c6797aff6580f68d60ca /st.c
parent4ef1ae3cceb7e798c5afe0847c62053c0fb847ee (diff)
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.
Diffstat (limited to 'st.c')
-rw-r--r--st.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/st.c b/st.c
index 516e5c5..8cd6ef5 100644
--- a/st.c
+++ b/st.c
@@ -2075,10 +2075,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)