From 730fc0b72d98d85496bb17a16670dcde551342f9 Mon Sep 17 00:00:00 2001 From: Zuz666 <109312+Zuz666@users.noreply.github.com> Date: Thu, 10 Sep 2026 16:22:36 +0500 Subject: [PATCH] mosquitto: fix nil pointer dereference panic in go-auth ttlcache (#4820) In iegomez/mosquitto-go-auth (v3.0.0), cache/cache.go checkRecord() called s.client.Has(record) followed by s.client.Get(record). When a cache entry expired between Has and Get or during Get, item was nil. Calling item.Value() without a nil check caused a nil pointer dereference panic in ttlcache.(*Item).Value(). Because the plugin is loaded via Cgo, this unhandled Go panic terminated the Mosquitto broker process. Add a nil check before calling item.Value() to return a cache miss (false, false) if the item is nil. Closes #4606 Closes #4655 Co-authored-by: Yuris Auzins --- mosquitto/CHANGELOG.md | 4 ++++ mosquitto/Dockerfile | 2 ++ mosquitto/config.yaml | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/mosquitto/CHANGELOG.md b/mosquitto/CHANGELOG.md index cc7e71834..2f262503d 100644 --- a/mosquitto/CHANGELOG.md +++ b/mosquitto/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 7.1.1 + +- Fix nil pointer dereference panic in go-auth ttlcache ACL check ([#4606](https://github.com/home-assistant/addons/issues/4606), [#4655](https://github.com/home-assistant/addons/issues/4655)) + ## 7.1.0 - Add `log_dest` and `log_type` configuration options diff --git a/mosquitto/Dockerfile b/mosquitto/Dockerfile index 942eb92cf..17d8b275b 100644 --- a/mosquitto/Dockerfile +++ b/mosquitto/Dockerfile @@ -57,6 +57,8 @@ RUN apt-get update \ && cd mosquitto-go-auth \ && sed -i 's/-I\/usr\/local\/include/-I\/usr\/include/' Makefile \ && sed -i 's/LDFLAGS := .*$/& -Wl,-unresolved-symbols=ignore-all/' Makefile \ + # Fix nil pointer dereference panic in ttlcache + && sed -i 's/return present, item.Value()/if item == nil { return false, false }\n\treturn true, item.Value()/' cache/cache.go \ && make \ && mkdir -p /usr/share/mosquitto \ && cp -f go-auth.so /usr/share/mosquitto \ diff --git a/mosquitto/config.yaml b/mosquitto/config.yaml index 472e65152..81dfe7189 100644 --- a/mosquitto/config.yaml +++ b/mosquitto/config.yaml @@ -1,5 +1,5 @@ --- -version: 7.1.0 +version: 7.1.1 slug: mosquitto name: Mosquitto broker description: An Open Source MQTT broker