aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-12-26 02:19:56 +0100
committerMax Kellermann <max@duempel.org>2009-12-26 03:01:48 +0100
commit115d26608bd059653a69b569253a352ad1427a97 (patch)
treec705d0dcc98cf1d0d827fcb31911406d20a11b06 /src
parentbad350bc18ab81661253bf42245b9e3fa175d026 (diff)
downloadmpd-115d26608bd059653a69b569253a352ad1427a97.tar.gz
mpd-115d26608bd059653a69b569253a352ad1427a97.tar.xz
mpd-115d26608bd059653a69b569253a352ad1427a97.zip
uri: check presence of slash in suffix
If there's a slash in the uri_get_suffix() return value, then it's malformed. Return NULL in this case.
Diffstat (limited to 'src')
-rw-r--r--src/uri.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/uri.c b/src/uri.c
index 5c33d3bae..41a613de7 100644
--- a/src/uri.c
+++ b/src/uri.c
@@ -33,9 +33,16 @@ bool uri_has_scheme(const char *uri)
const char *
uri_get_suffix(const char *uri)
{
- const char *dot = strrchr(g_basename(uri), '.');
+ const char *suffix = strrchr(g_basename(uri), '.');
+ if (suffix == NULL)
+ return NULL;
+
+ ++suffix;
+
+ if (strchr(suffix, '/') != NULL)
+ return NULL;
- return dot != NULL ? dot + 1 : NULL;
+ return suffix;
}
char *