From 50011b18426ec76e7da7397d290a3cad6fac9c52 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 6 Feb 2019 09:10:05 +0000 Subject: [PATCH] Log message for disconnecting a client with invalid UTF-8 topic. Closes #1144. Thanks to Kris Mattheus. --- ChangeLog.txt | 2 ++ src/handle_publish.c | 1 + 2 files changed, 3 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index 7785799e..3764ebfd 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -36,6 +36,8 @@ Broker: - Windows: Fix possible crash when client disconnects. Closes #1137. - Fixed durable clients being unable to receive messages when offline, when per_listener_settings was set to true. Closes #1081. +- Add log message for the case where a client is disconnected for sending a + topic with invalid UTF-8. Closes #1144. Library: - Fix TLS connections not working over SOCKS. diff --git a/src/handle_publish.c b/src/handle_publish.c index 76b3ee89..2402869b 100644 --- a/src/handle_publish.c +++ b/src/handle_publish.c @@ -70,6 +70,7 @@ int handle__publish(struct mosquitto_db *db, struct mosquitto *context) } if(mosquitto_validate_utf8(topic, slen) != MOSQ_ERR_SUCCESS){ + log__printf(NULL, MOSQ_LOG_INFO, "Client %s sent topic with invalid UTF-8, disconnecting.", context->id); mosquitto__free(topic); return 1; }