From 9584463c75675811a7455e0516f1cad0d893ac8f Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 25 Sep 2019 11:24:47 +0100 Subject: [PATCH] Fix potential crash when reloading config. Closes #1424, #1425. Thanks to JinPingChng and peteakalad. --- ChangeLog.txt | 1 + src/security_default.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 1855980b..e4b3f966 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -3,6 +3,7 @@ Broker: - Add workaround for working with libwebsockets 3.2.0. +- Fix potential crash when reloading config. Closes #1424, #1425. Client library: - Don't use `/` in autogenerated client ids, to avoid confusing with topics. diff --git a/src/security_default.c b/src/security_default.c index 07b34d40..80638bb4 100644 --- a/src/security_default.c +++ b/src/security_default.c @@ -1012,7 +1012,7 @@ int mosquitto_security_apply_default(struct mosquitto_db *db) /* Check for connected clients that are no longer authorised */ #ifdef WITH_TLS - if(context->listener->ssl_ctx && (context->listener->use_identity_as_username || context->listener->use_subject_as_username)){ + if(context->listener && context->listener->ssl_ctx && (context->listener->use_identity_as_username || context->listener->use_subject_as_username)){ /* Client must have either a valid certificate, or valid PSK used as a username. */ if(!context->ssl){ if(context->protocol == mosq_p_mqtt5){