~petersanchez/st

23054571754d806a1e36aa1de39a462362723173 — Jochen Sprickerhof 2 years ago 3d68fc6
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.
1 files changed, 2 insertions(+), 2 deletions(-)

M st.c
M st.c => st.c +2 -2
@@ 2022,10 2022,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)