aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-02-20 12:31:00 +0100
committerMax Kellermann <max@duempel.org>2009-02-20 12:31:00 +0100
commit09ecfb6567f3f4ea2e70e3e9d7f54c8f909271c0 (patch)
tree32247c639c9d72c97913f6672acf877392fdf899 /src
parentadea76a6edc54c9f3b957d47a54b74c322d54fc8 (diff)
downloadmpd-09ecfb6567f3f4ea2e70e3e9d7f54c8f909271c0.tar.gz
mpd-09ecfb6567f3f4ea2e70e3e9d7f54c8f909271c0.tar.xz
mpd-09ecfb6567f3f4ea2e70e3e9d7f54c8f909271c0.zip
path: validate configured character set
Diffstat (limited to '')
-rw-r--r--src/path.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/path.c b/src/path.c
index 01480bee4..1b6405cb0 100644
--- a/src/path.c
+++ b/src/path.c
@@ -21,6 +21,7 @@
#include <glib.h>
+#include <assert.h>
#include <string.h>
#undef G_LOG_DOMAIN
@@ -53,6 +54,16 @@ utf8_to_fs_charset(const char *path_utf8)
void path_set_fs_charset(const char *charset)
{
+ char *test;
+
+ assert(charset != NULL);
+
+ /* convert a space to ensure that the charset is valid */
+ test = g_convert(" ", 1, charset, "UTF-8", NULL, NULL, NULL);
+ if (test == NULL)
+ g_error("invalid filesystem charset: %s", charset);
+ g_free(test);
+
g_free(fs_charset);
fs_charset = g_strdup(charset);