From db141455840dfe4e2398542e0f72fd4c45f49ed6 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Wed, 15 Feb 2012 16:57:00 -0700 Subject: [PATCH] Fix SEGV for dirindex of /. First bugfix, woo! --- fnord.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fnord.c b/fnord.c index 2ea81f7..0f1ffc0 100644 --- a/fnord.c +++ b/fnord.c @@ -1072,15 +1072,16 @@ static void handledirlist(const char *origurl) { DIR *dir; - unsigned int nl = strlen(origurl); + unsigned int nl; const char *nurl = origurl; + url = (char *) origurl; while (nurl[0] == '/') ++nurl; if (nurl <= origurl) return; nl = strlen(nurl); - if (nurl[nl - 1] != '/') + if (nl && (nurl[nl - 1] != '/')) return; if (!stat(nl ? nurl : ".", &st) && (S_ISDIR(st.st_mode)) && ((st.st_mode & S_IRWXO) == 5)) {