utils: add proper handling of "/" special case in uh_path_match()
[project/uhttpd.git] / utils.c
diff --git a/utils.c b/utils.c
index 29e03c0b9a3fc83e9b41604a545cf52ec42b35e0..9342eb668022df21d62d968c6bd67a48c0dd0921 100644 (file)
--- a/utils.c
+++ b/utils.c
@@ -208,6 +208,10 @@ bool uh_path_match(const char *prefix, const char *url)
 {
        int len = strlen(prefix);
 
+       /* A prefix of "/" will - by definition - match any url */
+       if (prefix[0] == '/' && len == 1)
+               return true;
+
        if (strncmp(url, prefix, len) != 0)
                return false;