cwm exec can crash the whole X session

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

cwm exec can crash the whole X session

Rickard Gustafsson
If using exec in cwm to launch a program outside of $PATH by giving the
path to the program cwm will die if you happen to press up or down.

Example:
M-?
/opt (and press down)
Boom crash because cwm tries to write to a null pointer.

I have solved this for my self by not letting cwm work on the queues if the
searchstr starts with '/'.

cwm.patch (658 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: cwm exec can crash the whole X session

Okan Demirmen
On Mon 2017.04.17 at 17:21 +0200, Rickard Gustafsson wrote:

> If using exec in cwm to launch a program outside of $PATH by giving the
> path to the program cwm will die if you happen to press up or down.
>
> Example:
> M-?
> /opt (and press down)
> Boom crash because cwm tries to write to a null pointer.
>
> I have solved this for my self by not letting cwm work on the queues if the
> searchstr starts with '/'.

Hi - Thank you for the report. In fact, I knew about something like this for a
while but didn't know how to reproduce it, until now. In any case, your idea
works as a quick fix, but the menu'ing code needs some help to solve it
for real.

Thanks!

> --- menu_orig.c 2017-04-17 17:14:32.165495552 +0200
> +++ menu.c 2017-04-17 17:14:02.548495202 +0200
> @@ -236,6 +236,9 @@
>   }
>   break;
>   case CTL_UP:
> + if (mc->searchstr[0] == '/')
> + return(NULL);
> +
>   mi = TAILQ_LAST(resultq, menu_q);
>   if (mi == NULL)
>   break;
> @@ -244,6 +247,9 @@
>   TAILQ_INSERT_HEAD(resultq, mi, resultentry);
>   break;
>   case CTL_DOWN:
> + if (mc->searchstr[0] == '/')
> + return(NULL);
> +
>   mi = TAILQ_FIRST(resultq);
>   if (mi == NULL)
>   break;

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: cwm exec can crash the whole X session

Okan Demirmen
On Fri 2017.04.21 at 07:34 -0400, Okan Demirmen wrote:

> On Mon 2017.04.17 at 17:21 +0200, Rickard Gustafsson wrote:
> > If using exec in cwm to launch a program outside of $PATH by giving the
> > path to the program cwm will die if you happen to press up or down.
> >
> > Example:
> > M-?
> > /opt (and press down)
> > Boom crash because cwm tries to write to a null pointer.
> >
> > I have solved this for my self by not letting cwm work on the queues if the
> > searchstr starts with '/'.
>
> Hi - Thank you for the report. In fact, I knew about something like this for a
> while but didn't know how to reproduce it, until now. In any case, your idea
> works as a quick fix, but the menu'ing code needs some help to solve it
> for real.
>
> Thanks!

Hi - I've committed a fix (a partial revert) for this in r1.62 of search.c -
turns out it was a bad conversion to menuq_add() back in 2014.

Thanks for the report!
Okan

> > --- menu_orig.c 2017-04-17 17:14:32.165495552 +0200
> > +++ menu.c 2017-04-17 17:14:02.548495202 +0200
> > @@ -236,6 +236,9 @@
> >   }
> >   break;
> >   case CTL_UP:
> > + if (mc->searchstr[0] == '/')
> > + return(NULL);
> > +
> >   mi = TAILQ_LAST(resultq, menu_q);
> >   if (mi == NULL)
> >   break;
> > @@ -244,6 +247,9 @@
> >   TAILQ_INSERT_HEAD(resultq, mi, resultentry);
> >   break;
> >   case CTL_DOWN:
> > + if (mc->searchstr[0] == '/')
> > + return(NULL);
> > +
> >   mi = TAILQ_FIRST(resultq);
> >   if (mi == NULL)
> >   break;
>

Loading...