summaryrefslogtreecommitdiff
path: root/src/output
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-11-08 09:37:18 +0100
committerMax Kellermann <max@musicpd.org>2018-11-08 09:37:18 +0100
commit583208db7ed9e520af6f460dafa8484f38d2bc7a (patch)
tree3c0818a83d533ff691ca2d23aff980dd2073f69d /src/output
parent7b5ba15170432330ffb4504e323921fecfbbe3b7 (diff)
output/httpd: fix nullptr dereference crash bug
When `metadata_sent` is `false`, the plugin assumes there is metadata which must be sent, even if no metadata page was passed to the plugin. Initializing it to `true` avoids dereferencing this `nullptr`. Fixes #412
Diffstat (limited to 'src/output')
-rw-r--r--src/output/plugins/httpd/HttpdClient.hxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/output/plugins/httpd/HttpdClient.hxx b/src/output/plugins/httpd/HttpdClient.hxx
index f43c508d9..36da0a5ee 100644
--- a/src/output/plugins/httpd/HttpdClient.hxx
+++ b/src/output/plugins/httpd/HttpdClient.hxx
@@ -98,8 +98,11 @@ class HttpdClient final
/**
* If the current metadata was already sent to the client.
+ *
+ * Initialized to `true` because there is no metadata #Page
+ * pending to be sent.
*/
- bool metadata_sent = false;
+ bool metadata_sent = true;
/**
* The amount of streaming data between each metadata block