Skip to content

Commit

Permalink
Fix null pointer access in strhandle
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jspricke authored and hiltjo committed Dec 27, 2021
1 parent 273db5c commit a0467c8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions st.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a0467c8

Please sign in to comment.