From ab45f86d7421a80b46d8a7c3b5c6e9984fe7347d Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Thu, 22 Jun 2017 09:47:03 +0100 Subject: [PATCH] Prevent out of bounds array access. --- src/loop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/loop.c b/src/loop.c index 46f15d24..0828c40c 100644 --- a/src/loop.c +++ b/src/loop.c @@ -539,7 +539,7 @@ static void loop_handle_reads_writes(struct mosquitto_db *db, struct pollfd *pol } }while(SSL_DATA_PENDING(context)); } - if(pollfds[context->pollfd_index].revents & (POLLERR | POLLNVAL | POLLHUP)){ + if(context->pollfd_index >= 0 && pollfds[context->pollfd_index].revents & (POLLERR | POLLNVAL | POLLHUP)){ do_disconnect(db, context); continue; }