diff options
author | chenguolong <cgl.chenguolong@huawei.com> | 2020-02-04 16:05:02 +0800 |
---|---|---|
committer | Azat Khuzhin <azat@libevent.org> | 2020-02-16 02:54:15 +0300 |
commit | 968bbd5c918568eb95b493af05c464ddfc36671b (patch) | |
tree | 0c4c4d07b1ac89f5b4d6e5b0073ec97454868681 /event.c | |
parent | 5fbe6313ae7e81cde3e056b29171a6346c54aa0b (diff) | |
download | libevent-968bbd5c918568eb95b493af05c464ddfc36671b.tar.gz |
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>
Diffstat (limited to 'event.c')
-rw-r--r-- | event.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -2091,6 +2091,9 @@ event_base_once(struct event_base *base, evutil_socket_t fd, short events, int res = 0; int activate = 0; + if (!base) + return (-1); + /* We cannot support signals that just fire once, or persistent * events. */ if (events & (EV_SIGNAL|EV_PERSIST)) |