X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;ds=sidebyside;f=src%2Fevent.c;h=6603ebf0d66801c900d2ee56faf65be8e6c2d39b;hb=3bfdf45893f28f232c5851eb67d1800dc5004687;hp=1283edd332b8334fa8fc78a6faedb03d2a397516;hpb=d6b45d005530496e48325a6174ecdd889a17bfc1;p=tinc diff --git a/src/event.c b/src/event.c index 1283edd3..6603ebf0 100644 --- a/src/event.c +++ b/src/event.c @@ -1,6 +1,6 @@ /* event.c -- I/O, timeout and signal event handling - Copyright (C) 2012-2018 Guus Sliepen + Copyright (C) 2012-2021 Guus Sliepen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -435,12 +435,12 @@ bool event_loop(void) { break; } - if(result >= event_count - event_offset) { - return(false); + if(result < WSA_WAIT_EVENT_0 || result >= WSA_WAIT_EVENT_0 + event_count - event_offset) { + return false; } /* Look up io in the map by index. */ - event_index = result - event_offset; + event_index = result - WSA_WAIT_EVENT_0 + event_offset; io_t *io = io_map[event_index]; if(io->fd == -1) {