From bfb1b641f990968558f9b23ced663a387a19bde6 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 28 Oct 2021 13:39:12 +0200 Subject: [PATCH] db/update/InotifyUpdate: fix use-after-free bug Regression by commit 2d8847f4281a934cd72360b9cd1a33ab746b7efb --- NEWS | 2 ++ src/db/update/InotifyUpdate.cxx | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index ec66b608c..7f2fecb9b 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,8 @@ ver 0.23.3 (not yet released) * protocol - add optional position parameter to "add" and "playlistadd" - allow range in "playlistdelete" +* database + - inotify: fix use-after-free bug * output - alsa: add option "stop_dsd_silence" to work around DSD DAC noise * macOS: fix libfmt related build failure diff --git a/src/db/update/InotifyUpdate.cxx b/src/db/update/InotifyUpdate.cxx index 863a2d782..888682df9 100644 --- a/src/db/update/InotifyUpdate.cxx +++ b/src/db/update/InotifyUpdate.cxx @@ -282,7 +282,7 @@ InotifyUpdate::InotifyCallback(int wd, unsigned mask, (mask & IN_ISDIR) != 0) { /* a sub directory was changed: register those in inotify */ - const Path root_path = root->name; + const auto root_path = root->name; const auto path_fs = uri_fs.IsNull() ? root_path