From 39b303bffbcb52ea36b1d5e30d8531e752233505 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Tue, 10 Aug 2021 23:29:30 +0200 Subject: getmime: robustness for empty mime table MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Found by Érico Nogueira. --- hittpd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hittpd.c b/hittpd.c index d38f9a9..e5114d6 100644 --- a/hittpd.c +++ b/hittpd.c @@ -467,7 +467,8 @@ getmime(const char *mime, char *ext) const char *c = mime; do { - c++; + if (*c == ':') + c++; if (strncmp(c, ext, extlen) == 0 && c[extlen] == '=') return c + extlen + 1; } while ((c = strchr(c, ':'))); -- cgit 1.4.1