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.
This commit is contained in:
Max Kellermann 2009-12-26 02:19:56 +01:00
parent bad350bc18
commit 115d26608b

View File

@ -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;
return dot != NULL ? dot + 1 : NULL;
++suffix;
if (strchr(suffix, '/') != NULL)
return NULL;
return suffix;
}
char *