Re: [hackers] [PATCH st v2] Fix null pointer access in strhandle

From: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Mon, 27 Dec 2021 13:08:33 +0100

On Mon, Dec 27, 2021 at 11:41:42AM +0100, suckless_AT_jochen.sprickerhof.de wrote:
> From: Jochen Sprickerhof <git_AT_jochen.sprickerhof.de>
>
> 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.
> ---
> st.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/st.c b/st.c
> index 6783c2b..de2dd0e 100644
> --- a/st.c
> +++ b/st.c
> _AT_@ -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)
> --
> 2.34.1
>
>

Applied and pushed, thank you

-- 
Kind regards,
Hiltjo
Received on Mon Dec 27 2021 - 13:08:33 CET

This archive was generated by hypermail 2.3.0 : Mon Dec 27 2021 - 13:12:31 CET