[PATCH] potential array overrun
Marc Lehmann
schmorp at schmorp.de
Tue Jun 12 18:30:11 CEST 2012
On Tue, Jun 12, 2012 at 10:53:10AM +0200, Zsbán Ambrus <ambrus at math.bme.hu> wrote:
> > - if (expect_false (signum <= 0 || signum > EV_NSIG))
> > + if (expect_false (signum <= 0 || signum >= EV_NSIG))
> > return;
> >
> > --signum;
>
> I think your reasoning is incorrect. While this may seem strange, 64
> (equal to EV_NSIG - 1) is typically a valid signal number on Linux
64 is indeed equal to NSIG - 1, and the condition then becomes:
> > + if (expect_false (signum <= 0 || signum >= 65))
which allows 64 as signal number.
> > (it's SIGRTMAX, the lowest priority POSIX sigqueue signal). Thus,
> > libev should support watchers on this signal number.
>
> Indeed. Thanks for pointing that out.
>
> /usr/include/asm-generic/signal.h
> #define _NSIG 64
Thats probably the internal kernel header, the user space definition of NSIG
(and _NSIG) is "highest signal number + 1".
On glibc gnu/linux systems, that's 65, allowing 1..64 as signal numbers.
--
The choice of a Deliantra, the free code+content MORPG
-----==- _GNU_ http://www.deliantra.net
----==-- _ generation
---==---(_)__ __ ____ __ Marc Lehmann
--==---/ / _ \/ // /\ \/ / schmorp at schmorp.de
-=====/_/_//_/\_,_/ /_/\_\
More information about the libev
mailing list