mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
event_base_once: fix potential null pointer threat
supposing if base is null, EVBASE_ACQUIRE_LOCK and EVBASE_RELEASE_LOCK would get a coredump, so we add a guard for protection. Signed-off-by: chenguolong <cgl.chenguolong@huawei.com> (cherry picked from commit 968bbd5c918568eb95b493af05c464ddfc36671b)
This commit is contained in:
parent
9e993c3cdb
commit
2e9ceb1655
3
event.c
3
event.c
@ -2056,6 +2056,9 @@ event_base_once(struct event_base *base, evutil_socket_t fd, short events,
|
|||||||
int res = 0;
|
int res = 0;
|
||||||
int activate = 0;
|
int activate = 0;
|
||||||
|
|
||||||
|
if (!base)
|
||||||
|
return (-1);
|
||||||
|
|
||||||
/* We cannot support signals that just fire once, or persistent
|
/* We cannot support signals that just fire once, or persistent
|
||||||
* events. */
|
* events. */
|
||||||
if (events & (EV_SIGNAL|EV_PERSIST))
|
if (events & (EV_SIGNAL|EV_PERSIST))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user