diff options
author | Max Kellermann <max@duempel.org> | 2009-12-26 02:19:56 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-12-26 03:01:48 +0100 |
commit | 115d26608bd059653a69b569253a352ad1427a97 (patch) | |
tree | c705d0dcc98cf1d0d827fcb31911406d20a11b06 /src | |
parent | bad350bc18ab81661253bf42245b9e3fa175d026 (diff) | |
download | mpd-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.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -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 * |