Re: [hackers] [st][PATCH] adds tmux clipboard PRIMARY support, fixed double-free

From: Ivan Delalande <colona_AT_ycc.fr>
Date: Wed, 18 Jan 2017 22:34:42 +0100

Hey,

On Wed, Jan 18, 2017 at 05:38:20PM +0000, fpqc ?? wrote:
> _AT_@ -2538,6 +2538,14 @@ strhandle(void)
> break;
> p = strescseq.args[2];
> /* FALLTHROUGH */

Watch out, you are breaking the fallthrough from case 4, you need to put
the new case before or after the case 4/104 group.

> + case 52:
> + if (narg > 2){
> + char *src=strescseq.args[2];
> + size_t l = (strlen(src)/4)*3;
> + char *buf=xmalloc(l+1);
> + base64dec(buf, src, l);
> + xsetsel(buf, CurrentTime);
> + }

And you probably want to exit the function here, not go to color reset,
or "unknown str" (if you move your code after case 104).

Also, try to be consistent in your spacing and declarations, and with
the rest of the file too.

> case 104: /* color reset, here p = NULL */
> j = (narg > 1) ? atoi(strescseq.args[1]) : -1;
> if (xsetcolorname(j, p)) {


Looks fine otherwise, but I would still be against merging it into st,
because of all that base64 suck.

-- 
Ivan "Colona" Delalande
Received on Wed Jan 18 2017 - 22:34:42 CET

This archive was generated by hypermail 2.3.0 : Wed Jan 18 2017 - 22:36:17 CET