From c418b57d0f1b37ae0ae8f409efd2091917d38dab Mon Sep 17 00:00:00 2001 From: Roger Light Date: Thu, 8 Apr 2021 22:49:11 +0100 Subject: [PATCH] Fix possible crash having just upgraded from 1.6. Happens if `per_listener_settings true` is set, and a SIGHUP is sent to the broker before a client has reconnected to the broker. Closes #2167. Thanks to momoskitto. --- ChangeLog.txt | 5 +++++ src/security.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index add80098..34549160 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,6 +1,11 @@ 2.0.11 - 2021-xx-xx =================== +Broker: +- Fix possible crash having just upgraded from 1.6 if `per_listener_settings + true` is set, and a SIGHUP is sent to the broker before a client has + reconnected to the broker. Closes #2167. + Clients: - If sending mosquitto_sub output to a pipe, mosquitto_sub will now detect that the pipe has closed and disconnect. Closes #2164. diff --git a/src/security.c b/src/security.c index 98b4d962..1f51d72b 100644 --- a/src/security.c +++ b/src/security.c @@ -764,6 +764,9 @@ int mosquitto_unpwd_check(struct mosquitto *context) rc = MOSQ_ERR_PLUGIN_DEFER; if(db.config->per_listener_settings){ + if(context->listener == NULL){ + return MOSQ_ERR_AUTH; + } opts = &context->listener->security_options; }else{ opts = &db.config->security_options;