From f849b07766e090baaf3a28701c5470b14f7e26fd Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Fri, 6 Nov 2020 15:33:46 +0100
Subject: [PATCH 1/2] storage/curl: fix nullptr dereference

Pass a std::string to PathTraitsUTF8::Relative(), implicitly casting
it to std::string_view.  This selects the right overload which returns
std::string_view instead of `const char *`; the latter could return
`nullptr` which would cause the implicit conversion of the return
value to std::string_view to crash.

Regression caused by commits ead208987dd and a98d627c0bd.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/995
---
 NEWS                                | 2 ++
 src/storage/plugins/CurlStorage.cxx | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index e0e7d2a83..f445b6c3e 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,8 @@
 ver 0.22.3 (not yet released)
 * playlist
   - add option "as_directory", making CUE file expansion optional
+* storage
+  - curl: fix crash bug
 * filter
   - fix garbage after "Audio format not supported by filter" message
   - ffmpeg: support planar output
diff --git a/src/storage/plugins/CurlStorage.cxx b/src/storage/plugins/CurlStorage.cxx
index e6de47f11..5d7292085 100644
--- a/src/storage/plugins/CurlStorage.cxx
+++ b/src/storage/plugins/CurlStorage.cxx
@@ -80,7 +80,7 @@ std::string_view
 CurlStorage::MapToRelativeUTF8(std::string_view uri_utf8) const noexcept
 {
 	return PathTraitsUTF8::Relative(base,
-					CurlUnescape(uri_utf8).c_str());
+					CurlUnescape(uri_utf8));
 }
 
 class BlockingHttpRequest : protected CurlResponseHandler {

From f6c65cba58f5e802eee547c4820bbef67f37af95 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Fri, 6 Nov 2020 16:12:54 +0100
Subject: [PATCH 2/2] release v0.22.3

---
 NEWS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index f445b6c3e..10b5e1883 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-ver 0.22.3 (not yet released)
+ver 0.22.3 (2020/11/06)
 * playlist
   - add option "as_directory", making CUE file expansion optional
 * storage